guetzli icon indicating copy to clipboard operation
guetzli copied to clipboard

jpg advantage and png disadvantaged?

Open vdingtian opened this issue 8 years ago • 4 comments

i,try some test,comare with imagemagick. use guetzli compress jpg better than imagemagick,bug png is not。

better means Similar clarity , file size Smaller.

why?

vdingtian avatar Mar 22 '17 10:03 vdingtian

Thanks for trying out Guetzli. Could you post the files you've tried and the sequences of commands you've used?

robryk avatar Mar 22 '17 15:03 robryk

/bin/Release/guetzli --quality 84 source.png compress_by_guetzli.png /bin/Release/guetzli --quality 84 source.png compress_by_guetzli.jpg

magick -quality 84 source.png compress_by_magick.png magick -quality 84 source.png compress_by_magick.jpg

source.png: source

compress_by_guetzli.jpg compress_by_guetzli

compress_by_guetzli.png compress_by_guetzli

compress_by_magick.jpg compress_by_magick

compress_by_magick.png compress_by_magick

vdingtian avatar Mar 23 '17 02:03 vdingtian

Guetzli doesn't produce png files. The compress_by_guetzli.png is actually a JPEG file and is identical to compress_by_guetzli.jpg

It's true that the png files are smaller than the jpg files produced here. This appears to be an image where png format works very well.

compress_by_gutezli.jpg is larger than compress_by_magick.jpg, but is of significantly higher quality (e.g. compress_by_magick.jpg has strong artifacts on the sides of the "1" in the label on the left). The quality parameter comes from a made-up scale. Guetzli's quality is designed to approximate the meaning of JPEG quality in YUV444 mode. The ImageMagick image was generated in YUV420 mode (which reduces filesize and quality). If you encode using ImageMagick in YUV444 mode with the same quality parameter:

convert source.png -sampling-factor 4:4:4 -quality 84 magick_444.jpg

you get an image that's of similar quality to compress_by_guetzli.jpg, but larger.

robryk avatar Mar 23 '17 16:03 robryk

I did get something similar to what this issue's title suggests.

  • I put a PNG in, didn't set a guetzli quality flag. Got 401 KB output jpeg. Details a few pixels large are slightly blurry.
  • opened the PNG in GIMP, exported as JPG with floating-point precision DCT, no chroma subsampling (4x4), 100% quality.
    • Then put this high quality JPEG in, didn't set a guetzli quality flag, got 399 KB output jpeg. Small details are less blurry. Looks a bit better to me.

So I get smaller output with finer details if I give a JPEG in than if I give a similar-looking PNG in.

PNG in: city-photo-sharper-1600.png

JPEG in: city-photo-sharper-1600-gimp-100.jpg

(I think anything that produces an optimized DCT before using Guetzli, but otherwise leaves visible quality alone, improves Guetzli's output. So, running any jpeg encoder with DCT optimization turned on, and output at quality 100, should reduce the file size Guetzli produces by some amount. It's not a lot, but it can make a difference, especially for small files.)

DeeDeeG avatar May 23 '17 18:05 DeeDeeG