google / guetzli

Perceptual JPEG encoder
Apache License 2.0
12.9k stars 977 forks source link

failed to convert some images. #120

Open ghost opened 7 years ago

ghost commented 7 years ago

e.g., black and white jpg image, such as "cmd.exe" screenshort can't be converted using guetzli. guetzli shows an error and exit automatically.

guetzli in.jpg out.jpg

Actual result: Didn't create out.jpg

Expected result: Just create a copy for the result. (copy in.jpg to out.jpg)

robryk commented 7 years ago

Please provide an example of such an image and the error message you receive.

addy commented 7 years ago

Using the 32-bit guetzli executable, I am unable to reproduce this on Windows. I am using a screenshot of command prompt, as listed above with background color set to rgb(0,0,0) and text color set to rgb(255,255,255).

Original image size: 7.00kb. Compressed image size: 5.84kb.

I'm attaching my original image for you to try @wetubeyou

test

addy commented 7 years ago

@wetubeyou Could you just upload an image file instead of a zip?

shadowwalker commented 7 years ago

@wetubeyou

Add a data point

$ guetzli b455855db158cd12897cd242df2f81c0.jpg out.jpg
Only YUV color space input jpeg is supported
Guetzli processing failed

Tested on my Macbook Pro, guetzli installed with brew.

shadowwalker commented 7 years ago

@wetubeyou I suggest you stop testing on these white and black pictures. Because if you read the README.md, there is some hint about what it's supporting.

Note: Guetzli assumes that input is in sRGB profile with a gamma of 2.2. Guetzli will ignore any color-profile metadata in the image.

Besides this, per my understanding, guetzli is not designed to recompress those black and white pictures. As it's taking advantage of human vision pattern in it's compression process. It simply doesn't make sense to recompress something there is nowhere to improve, in another words, the traditional jpeg algorithms is doing pretty well on those pictures.

If you insist testing on those pictures, you can first convert them in sRGB profile using some tools. Then test it, it should be working. It's not about the color, it's just the profile is not correct.

I tested on a screenshot I took, it improves from 1MB to 992KB, almost no improvement but waste a lot of CPU time.

Enjoy hacking!

ghost commented 7 years ago

Actual result: Didn't create out.jpg

Expected result: Just create a copy for the result. (copy in.jpg to out.jpg