format

Specifies the desired output encoding for the image.

The format parameter enables the source image to be converted (a.k.a., "transcoded") from one encoded format to another. This is useful when the source image has been saved in a sub-optimal file format that hinders performance.

Syntax

format={value}

Allowed values

ValueDescription
gifGraphics Interchange Format
pngPortable Network Graphics
png8Portable Network Graphics palette image with 256 colors and 8-bit transparency
jpgJPEG (also jpeg)
pjpgProgressive JPEG (also pjpeg)
bjpgBaseline JPEG (also bjpeg)
webpWebP
webpllWebP (Lossless)
webplyWebP (Lossy)
mp4MP4 (H.264)

Notes

  1. Automatic delivery of WebP format images via content negotiation can be enabled using the auto=webp parameter. This will override the format parameter in browsers that support WebP. Although the WebP format produces images at a higher compression ratio with a lower loss of quality, it is not supported in all browsers.
  2. The source image can be any of the following image formats: JPEG, PNG, GIF, WEBP.
  3. JPEG, progressive JPEG, WebP (Lossy), and PNG8 have a sliding quality scale that supports the quality parameter.
  4. GIF and PNG do not have a sliding quality scale. They do not support the quality parameter.
  5. A progressive JPEG pjpg is an image created using the JPEG suite of compression algorithms that will "fade in" successive waves of lines until the entire image has completely arrived. For this reason, progressive JPEGs typically appear to load quicker than the Baseline JPEG jpg format.
  6. WebP support is available in Google Chrome, Mozilla Firefox 65 and later, Safari 14 and later, Opera, and Android Browser.
  7. Lossless compression is currently supported for WebP only.
  8. GIF to WebP conversion is currently not supported.
  9. MP4 conversion is only available for animated GIF source images.

Examples

Click the links to view the transformed image using a demo Fastly IO service.

Example usageDescription
?format=png8Convert to PNG8
?format=mp4Convert an animated GIF to MP4 video
?format=pjpg&quality=95Convert to a progressive JPEG with 95% quality