Skip to content

Specifying image quality

Matthias Winkelmann edited this page Aug 1, 2018 · 6 revisions

When working with lossy image formats like JPEG, you can control how much the output image will be compressed by specifying the desired "quality".

MiniMagick

The quality of the output JPEG image is specified using the -quality option, which you can specify as a saver option:

ImageProcessing::MiniMagick
  .resize_to_limit(400, 400)
  .saver(quality: 75) # specify quality
  .call(image)

Vips

The quality of the output JPEG image is specified using the :Q saver option, but we can use the :quality alias:

ImageProcessing::Vips
  .resize_to_limit(400, 400)
  .saver(quality: 75) # specify quality
  .call(image)