Format & Quality

On this page

Sirv can serve your images in either JPEG, PNG, WebP, AVIF or GIF format - regardless of your original image format. By default, it does automatically serves the most suitable image, thanks to Sirv's "optimal" format.

Optimal

The default image format is called optimal and we recommend keeping this setting.

There are no settings to change - simply upload your images to Sirv in their existing format and Sirv will serve them in the best possible format for each users' device. The smallest file size image format is usually AVIF or WebP, though sometimes an optimized PNG or a compressed JPEG may be more suitable.

Whether your original images are in JPEG, PNG, AVIF, WebP or GIF format, the "optimal" format will ensure that every visitor receives the fastest loading image format for their device. Read more about the optimal format on our blog.

Original

To always serve the original image format to all devices/browsers, set the 'format' parameter to "original":

https://demo.sirv.com/look.jpg?format=original

Original image format (JPEG)

With the original format, images will be optimized and/or compressed but they will not change the format.

WebP

WebP is a next-gen image format that you'll instantly benefit from with Sirv. The default "optimal" format automatically serves lossy WebP images to supporting browsers. As of May 2024, 97% of web users could view WebP images. Browsers that do not support WebP will receive JPEG or PNG images.

WebP images are typically 40-70% smaller than their PNG, JPEG and GIF equivalents. Developed by Google, WebP supports transparency, alpha, and animation, making it a powerful alternative to all image major formats - JPEG, PNG and GIF.

WebP is automatically applied with the default "optimal" format. If you want to specifically tell Sirv to serve images in WebP format, set the format to webp like so:

https://demo.sirv.com/look.jpg?format=webp

AVIF

AVIF is an impressive next-gen format created by the Alliance for Open Media. It is even better than WebP at compressing images, whilst maintaining high quality detail. Browsers have gradually been adopting the AVIF image format and as of May 2024, 93% of web users could view AVIF images.

Example of image served in AVIF format:

https://demo.sirv.com/look.jpg?format=avif

That image is a mere 46 KB served as AVIF. In WebP format it is 89 KB. In JPEG format it is 99 KB.

If the browser does not support AVIF, the original image format will be served - either WebP, JPEG, PNG or GIF - whichever is most optimal.

JPEG

Sirv generates extremely well optimized JPEG images. It compresses the file size very small for the given quality that you choose (default is 80%). It also automatically calculates whether to generate JPEGs as baseline and progressive.

Although Sirv uses the most advanced JPEG compression algorithms, JPEG files are still bigger than AVIF and WebP, so the Sirv optimal format will usually serve one of those next-gen formats instead of JPEG format. However, JPEG is still the most reliable format - it can be viewed on 100% of browsers, plus it can be downloaded and opened in all image programs on all operating systems, unlike WebP and AVIF which still have limited suppport in photo viewing and editing programs.

To force Sirv to return a JPEG image rather than the most optimal format, set the format to jpg:

https://demo.sirv.com/look.jpg?format=jpg

Quality

Sirv compresses your images to 80% quality by default. This typically produces a good balance between a high-quality image and small file size for fast-loading.

Adjust this percentage up to increase image clarity or down to load images faster. Apply the q option for JPEG quality. The scale ranges from 0-100.

https://demo.sirv.com/look.jpg?q=40

To serve the image with the same quality as the original JPEG uploaded to Sirv, set q to 0. This might be useful if you’ve already pre-processed your images prior to upload and wish to maintain that setting.

For best results, we recommend that you upload uncompressed JPEGs – at least 92% quality or above. Every time a JPEG is compressed, it loses quality, so by uploading large uncompressed images, you’ll ensure maximum options for the future. Your final image will look sharp, by minimizing the quality loss that would otherwise be incurred when creating an optimized JPEG from an already optimized JPEG.

JPEG subsampling

Chroma subsampling reduces the file size of JPEG images by 25% on average, without any noticeable impact on the image. Smaller file size helps images load faster and reduces data transfer, so Sirv applies subsampling of 4:2:0 by default.

Subsampling is expressed as a three part ratio J:a:b (e.g. 4:2:0) which describes the number of luminance and chrominance samples in a region that is J pixels wide, and 2 pixels high. The parts are (in their respective order):

  • J: horizontal sampling reference (width of the conceptual region). Usually 4.
  • a: number of chrominance samples (Cr, Cb) in the first row of J pixels.
  • b: number of changes of chrominance samples (Cr, Cb) between first and second row of J pixels.

Sometimes, subtle color differences can be seen when comparing the original JPEG and the subsampled JPEG. If you have images which display visual differences due to chroma subsampling, you can change the subsampling option. The options are 4:4:4, 4:2:2 and 4:2:0, where 4:4:4 has no subsampling and 4:2:2 has some subsampling:

https://demo.sirv.com/look.jpg?subsampling=4:2:2

The following 3 JPEG images have settings of 4:4:4, 4:2:2 and 4:2:0 respectively:

Chroma subsampling demo 4:4:4
4:4:4 subsampling: 20.24 KB
Chroma subsampling demo 4:2:2
4:2:2 subsampling: 17.78 KB
Chroma subsampling demo 4:2:0
4:2:0 subsampling: 16.23 KB

WebP/AVIF fallback

If you've uploaded an image in WebP or AVIF format, it will be served in its original format and automatically fall-back to JPEG for unsupporting browsers.

Alternatively, you can use the webp.fallback option to specify a PNG fall-back, like so:

https://sirv.sirv.com/Examples/test-image.webp?webp.fallback=png

Was this article helpful?

Array

Get help from a Sirv expert

help ukraine help ukraine Powered by Ukrainian determination and British ingenuity

How can you support Ukraine