google / guetzli

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

Support resizing and/or thumbnail workflow #36

Open csuhta opened 7 years ago

csuhta commented 7 years ago

Web authors or content-management systems often need to export multiple sizes of an image for different UI or devices.

Based on the documentation and some quick tests I did, it seems like the ideal workflow that involves Guetzli would be:

  1. Have a huge source PNG
  2. Resize that source PNG into multiple smaller PNGs of the dimensions you need.
  3. Use Guetzli to convert those PNGs to hyper-optimized JPEGs.

Images made in that middle step are essentially discarded/overhead. You also need to use another library to do it, and try to preserve PNG quality as you go.

Is a feature that would resize the source image while processing in scope for this CLI?

$ guetzli --quality 85 --resize 720x480 in.png out.jpg

An big potential reason to avoid this is that people start asking for even more this-could-be-ImageMagick features.

geoffparky commented 7 years ago

+1... It feels to me like guetzli could do a better job if it has a larger source image to work with. If you have to resize before guetzli compression, there's less data to work with and not as good a result.

ghost commented 7 years ago

sounds like a reasonable approach to me

the question is: If you take a jpg 10x10 and resize it to a TIFF/ PNG 5x5 and then compress using guetzli

or put a 10x10 jpg into guetzli and get out a 5x5 jpg

can guetzli actually do a better job in the second case?

ghost commented 7 years ago

or as a second variant of that question, if you use a TIFF/ PNG for input and let guetzli work on the higher data density and output a lower density, can guetzli make any use of that?

ghost commented 7 years ago

@monouser7dig first and second case should result in the same thing, no? TIFF/PNG is lossless so whether there is a png step in-between or guetzli makes a bitmap or some other lossless form to resize doesn't matter. The only issue here is involving another tool (TIFF/PNG) and the extra time to convert and reconvert all over again.

This would be a good feature considering you'd have to resize images often, e.g. if you're uploading a photo to your website you're not likely to store say a 10MB+ original.

ghost commented 7 years ago

it does matter because if it's fed with a higher resolution image it might be able to do better optimisations

kirillgroshkov commented 6 years ago

+1