Format & Quality

On this page

Sirv can serve your images in either JPEG, PNG, GIF or WebP format - regardless of the original image format. By default, it does this automatically with the "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. Often, the smallest file size image format is WebP, so that is the format usually served to Chrome and Opera browsers, though sometimes an optimized PNG or a compressed JPEG may be more suitable.

Whether your original images are in JPEG, PNG or GIF format, the "optimal" format will ensure that every visitor receives the fastest loading image format for their device. Read more about format=optimal 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 modern image format that you'll instantly benefit from when you use Sirv. The default "optimal" format automatically serves lossy WebP images to supporting browsers and either JPEG or PNG to unsupporting browsers.

WebP compresses images to much smaller file sizes than their PNG, JPEG and GIF equivalents. File size is typically 40-70% smaller and image quality is typically sharper. Developed by Google, WebP supports transparency, alpha, and animation, making it a powerful alternative to JPEG, PNG, and GIF.

As of November 2018, 72% of web users could view WebP images. Chrome, Edge, Opera, Firefox and Android browsers all support WebP.

As WebP is enabled by default in the "optimal" image format, you need not specify it. However, if you want to specifically tell Sirv to serve your JPEG and PNG images in WebP format, set the 'format' option to 'webp' like so:

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

If you're currently using a WebP supporting browser, you'll see a WebP image below, otherwise you'll see a PNG:

PNG served as WebP

When served as a PNG with transparent background, that 250px height image is 87 KB. When served in WebP format, it is only 18 KB.

If you've uploaded an image that is already in WebP format, your images will be served as WebP and will automatically fall-back to JPEG for unsupporting browsers.

Below is an original WebP. If your browser does not support WebP, Sirv automatically serves it in JPEG format:

https://sirv.sirv.com/Examples/test-image.webp

WebP example image

To learn more about WebP, read Google's official WebP documentation.

Use the 'webp.fallback' option to control what format an original WebP image should fall back to when WebP isn't supported.

Original WebP images will fall back to JPEG. You can make them fall back to PNG like so:

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

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.

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, a very subtle color difference can be identified 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 available settings 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

Was this article helpful?

Get help from a Sirv expert

help ukraine help ukraine Powered by Ukrainian determination and British ingenuity

How can you support Ukraine