imazen-discovery/grlibs-stopwatch — pull request #1 by jcupitt (2013-11-09 12:28:51+00:00)
Title: improve vips_shrink

replace vips_shrink.c with something based on vipsthumbnail.c

this code needs vips 7.36 or later

vips_shrink.c was using im_shrink() to downsize images. This is a simple
box filter and does not give good results for non-integer shrinks.
It also has no knowledge of the jpeg file format and can't take
advantage of the many dodges that jpeg makes possible.

The vipsthumbnail code does the following:

- knows about jpeg shrink-on-load, this gives a very good speedup for
large shrink factors

- knows about embedded jpeg thumbnails: if the jpeg file has en embedded
theumbnail that's large enough, this is used as the pixel source
instead

- knows about jpeg, tiff and png sequential mode access, so images in
these formats can be shrunk with very low memory use

- uses bicubic plus a gentle sharpen as a finishing pass

- knows about color management, reducing thumbnail size considerably
since thumbnails do not need embedded profiles

On the downside, streaming plus shrink-on-load can mean repeated
decompression if you are generating many derivatives of a single image.
It might be better to decompress via a temporary file in this case.