Operation · convert

Convert and choose quality

Write PNG, JPEG, or WebP output and control lossy JPEG or WebP quality.

Convert chooses the output encoder. Rastry currently accepts and writes PNG, JPEG, and WebP.

CLI example

Terminal window
rastry photo.png --to webp --quality 82 --dry-run

The shorthand adds a conversion operation and then strips metadata. A quality value is an integer from 1 to 100 and is relevant to JPEG and WebP output. PNG is lossless and does not use a quality setting.

Pipeline example

{
"type": "convert",
"format": "webp",
"quality": 82
}

Choose PNG when lossless transparency matters, JPEG for opaque photographic output, and WebP when broad modern web delivery is the goal.

Related reading