Output format and options

You can use -o to specify the thumbnail image format too. For example: 

$ vipsthumbnail fred.jpg ../jim.tif -o tn_%s.png

Will write thumbnails in PNG format.

You can give options to the image write operation as a list of comma-separated arguments in square brackets. For example:

$ vipsthumbnail fred.jpg ../jim.tif -o tn_%s.jpg[Q=90,optimize_coding]

will write jpeg images with quality 90, and will turn on the libjpeg coding optimizer.

Check the image write operations to see all the possible options. For example:

$ vips jpegsave
save image to jpeg file
usage:
   jpegsave in filename
where:
   in           - Image to save, input VipsImage
   filename     - Filename to save to, input gchararray
optional arguments:
   Q            - Q factor, input gint
            default: 75
            min: 1, max: 100
   profile      - ICC profile to embed, input gchararray
   optimize-coding - Compute optimal Huffman coding tables, input gboolean
            default: false
   interlace    - Generate an interlaced (progressive) jpeg, input gboolean
            default: false
   no-subsample - Disable chroma subsample, input gboolean
            default: false
   trellis-quant - Apply trellis quantisation to each 8x8 block, input gboolean
            default: false
   overshoot-deringing - Apply overshooting to samples with extreme values, input gboolean
            default: false
   optimize-scans - Split the spectrum of DCT coefficients into separate scans, input gboolean
            default: false
   quant-table  - Use predefined quantization table with given index, input gint
            default: 0
            min: 0, max: 8
   strip        - Strip all metadata from image, input gboolean
            default: false
   background   - Background value, input VipsArrayDouble

The strip option is especially useful. Many image have very large IPCT, ICC or XMP metadata items embedded in them, and removing these can give a large saving.

For example:

$ vipsthumbnail 42-32157534.jpg
$ ls -l tn_42-32157534.jpg
-rw-r–r– 1 john john 6682 Nov 12 21:27 tn_42-32157534.jpg

strip almost halves the size of the thumbnail:

$ vipsthumbnail 42-32157534.jpg -o x.jpg[optimize_coding,strip]
$ ls -l x.jpg
-rw-r–r– 1 john john 3600 Nov 12 21:27 x.jpg