Colour management

vipsthumbnail will optionally put images through LittleCMS for you. You can use this to move all thumbnails to the same colour space. All web browsers assume that images without an ICC profile are in sRGB colourspace, so if you move your thumbnails to sRGB, you can strip all the embedded profiles. This can save several kb per thumbnail.

For example:

$ vipsthumbnail shark.jpg
$ ls -l tn_shark.jpg 
-rw-r–r– 1 john john 7295 Nov  9 14:33 tn_shark.jpg

Now transform to sRGB and don’t attach a profile (you can also use strip, though that will remove all metadata from the image):

$ vipsthumbnail shark.jpg --eprofile srgb -o tn_shark.jpg[profile=none]
$ ls -l tn_shark.jpg 
-rw-r–r– 1 john john 4229 Nov  9 14:33 tn_shark.jpg

(You can use the filename of any RGB profile. The magic string srgb selects a high-quality sRGB profile that’s built into libvips.)

tn_shark.jpg will look identical to a user, but it’s almost half the size.

You can also specify a fallback input profile to use if the image has no embedded one. This can often happen with CMYK images, producing an error message like:

$ vipsthumbnail kgdev.jpg
vipsthumbnail: unable to thumbnail kgdev.jpg
vips_colourspace: no known route from 'cmyk' to 'srgb'

If you supply a CMYK profile, it will be able to convert the image, for example:

$ vipsthumbnail kgdev.jpg --iprofile cmyk 

(As before, the magic string cmyk selects a high-quality CMYK profile that’s built into libvips, but you can use any CMYK profile you like.)