Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPEG image is "blocky" #17

Open
oliver-moran opened this issue Apr 28, 2016 · 9 comments
Open

JPEG image is "blocky" #17

oliver-moran opened this issue Apr 28, 2016 · 9 comments
Labels

Comments

@oliver-moran
Copy link

First, thanks very much for your library, which I am using in Jimp. Without this library and pngjs Jimp would not be possible.

An issue was raised about the picture below being "blocky" when it is decoded (especially the blurry background elements): jimp-dev/jimp#134

A test case using Jimp is as follows:

var Jimp = require("jimp");

Jimp.read("image.jpg").then(image => {
    image.quality(100).write("out.png");
});

If I convert the image to a PNG using GIMP and perform the same test on that image then the issue doesn't present. For that reason I think the issue lies here.

image

@ArmorDarks
Copy link

Hm, seems like library no longer maintained...

@benwiley4000
Copy link
Collaborator

Thanks @oliver-moran, and sorry for the delayed response. Could you confirm this issue still exists after recent updates?

@hipstersmoothie
Copy link

@benwiley4000 I'm a maintainer on jimp and running @oliver-moran code with the image. Blocky-ness seems to be gone now!

@benwiley4000
Copy link
Collaborator

Cool!

@hipstersmoothie
Copy link

hipstersmoothie commented Jul 28, 2018

IDK if it's fully fixed though. I found another issue where encoding and decoding right after one another produces a slightly different image.

const fs = require('fs')
const jpeg = require('jpeg-js');
const jpegData = fs.readFileSync('./exampleImages/npm.jpg');
const rawImageData = jpeg.decode(jpegData);
const jpegImageData = jpeg.encode(rawImageData, 100);

const Jimp = require('jimp')

fs.writeFileSync('./out.jpg', jpegImageData.data)

I know it's not super noticable, but if you zoom in on the u in you the pixelation around the letters gets slightly darker

npm

out

Input:
screen shot 2018-07-27 at 6 34 14 pm

Output:
screen shot 2018-07-27 at 6 33 40 pm

@benwiley4000
Copy link
Collaborator

Ok I'll reopen

@benwiley4000 benwiley4000 reopened this Jul 28, 2018
@hipstersmoothie
Copy link

It almost looks like its grouping together 4 pixels and only using 1 color from the 4

@patrickhulce
Copy link
Collaborator

The original issue may have been related to and partially fixed by #25 if they were progressive JPEGs. If not, probably separate issue we should try to hunt down :)

Given jimp-dev/jimp#121, it seems like it's still definitely on the decoding side not encoding side?

@hipstersmoothie
Copy link

hipstersmoothie commented Jul 28, 2018

yeah that makes sense since it happens when just decoding and then encoding to another format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants