Format

      Last updated September 22, 2020

    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.

    Supported Output Formats

    API Pattern

    format={value}

    Parameter

    Parameter Description
    format The output image format.

    Parameter Values

    Value Description
    gif Graphics Interchange Format
    png Portable Network Graphics
    png8 Portable Network Graphics palette image with 256 colors and 8-bit transparency
    png24 Portable Network Graphics RGB image with 16.8 million colors
    png32 Portable Network Graphics RGBA image with 16.8 million colors and 8-bit transparency
    jpg JPEG
    pjpg Progressive JPEG
    bjpg Baseline JPEG
    webp WebP
    webpll WebP (Lossless)
    webply WebP (Lossy)
    mp4 MP4 (H.264)

    Automatic WebP Format Selection

    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.

    Supported Input Formats

    The source image can be any of the following image formats:

    JPEG, PNG, GIF, WEBP

    Notes

    1. JPEG, progressive JPEG, WebP (Lossy) and PNG8 have a sliding quality scale that supports the quality parameter.
    2. GIF and PNG do not have a sliding quality scale. They do not support the quality parameter.
    3. 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 JPEG's typically appear to load quicker than the Baseline JPEG jpg format.
    4. WebP support is available in Google Chrome, Mozilla Firefox 65 and later, Safari 14 and later, Opera, and Android Browser.
    5. Lossless compression is currently supported for WebP only.
    6. GIF to WebP conversion is currently not supported.
    7. MP4 conversion is only available for animated GIF source images.

    Examples

    Description HTML Demo
    Convert to PNG8 - Convert the source WebP image to a PNG8. <img src="image.webp?format=png8"/> Example
    Convert to MP4 - Convert the source animated gif to mp4. <video width="300" height="224" src="image.gif?format=mp4" playsinline autoplay muted loop type="video/mp4"><!--[if lt IE 9]><img width="300" height="224" src="image.gif?image.gif">![endif]--></video> Example
    Advanced Examples (Combining Additional Parameters)
    Description HTML Additional Param Demo
    Convert to a progressive JPEG with 95% quality <img src="image.png?format=pjpg&quality=95"/> quality Example
    Back to Top