Documentation

fm Output Format

The output format to convert the image to. Valid options are gif, jp2, jpg, json, jxr, pjpg, mp4, png, png8, png32, and webp.

gif

Animated GIF functionality is currently in Beta. We will make an announcement when all customers have access to animated GIF rendering and features.

The GIF file format is a lossy format. It does support transparency, although in a very limited capacity (1-bit). It does support animation.

The GIF image format is a file format popularized for its ability to create simple animations. imgix supports both animated GIFs and static GIFs. GIF files make use of limited color palettes. There are additional parameters that can be used to control the playback of GIFs. fps, frame, loop, and reverse. Animated GIFs will accept most imgix image manipulation parameters.

w=448&h=300&fit=crop
Imgix logo ani
fit=crop&sat=-50&reverse=true&rot=-45&fps=45
Imgix logo ani
frame=40
Imgix logo ani

jp2

The JPEG 2000 file format is a lossy format. It does not support transparency. It does not support animation.

JPEG 2000 compresses slightly better than JPEG in many cases (roughly 10% for equivalent quality). It also degrades more gracefully than JPEG at lower bitrates. However, unlike JPEG, JPEG 2000 was less widely adopted as an image format.

For a list of browsers that support JPEG 2000, please see the JPEG 2000 section on caniuse.com. If auto=format is set and the browser does not support the JPEG 2000 format, imgix will fall back to any format specified by the fm parameter, and finally the source image type.

jpg

The JPEG file format is a lossy format. It does not support transparency. It does not support animation.

JPEG is one of the most common formats on the web. It excels at displaying photographs. See the q parameter for controlling the quality of the image.

json

A non-image, JSON file format. This is a data representation of the image specified. This will include keys and values relating to the source image DPI, height, width, color profiles, color models, bit depth, and more. The output data will vary depend on input filetype. Here is an example document from a JPEG source image:

{
  "DPIHeight": 72,
  "Depth": 8,
  "ColorModel": "RGB",
  "DPIWidth": 72,
  "PixelHeight": 800,
  "PixelWidth": 532,
  "JFIF": {
    "DensityUnit": 1,
    "YDensity": 72,
    "JFIFVersion": [
      1,
      1
    ],
    "XDensity": 72
  },
  "ProfileName": "sRGB IEC61966-2.1"
}

jxr

The JPEG XR file format is a lossy format, but supports lossless compression. It does support transparency. It does not support animation.

JPEG XR file format supports higher compression ratios in comparison to JPEG for encoding an image with equivalent quality. In order to have a JPEG XR file delivered as lossless, set lossless=true.

For a list of browsers that support the JPEG XR format, please see the JPEG XR section on caniuse.com. If auto=format is set and the browser does not support the JPEG XR format, imgix will fall back to any format specified by the fm parameter, and finally the source image type.

pjpg

The Progressive JPEG file format is a lossy format. It does not support transparency. It does not support animation.

The Progressive JPEG format offers advantages over traditional JPEG files. The advantages include potentially smaller file sizes and faster perceived load times than typical baseline JPEGs.

With proper client side display support, Progressive JPEGs can load an initial version of the image with only a portion of the image data. The image will briefly appear pixelated and will sharpen focus as the rest of the data loads.

mp4

imgix offers the MP4 format for Animated GIF to MP4 conversion. MP4 is a video format that will reproduce animations at a much smaller file size than Animated GIFs. MP4 is to be used with the video tag, see below. MP4 will accept any imgix operations passed to the Animated GIF.

<video id="sampleMovie" width="620" height="349" poster="https://assets.imgix.net/gif-examples/imgix-logo-ani.gif?fm=jpg&w=620&h=349&fit=crop&frame=3"  controls loop>
  <source src="https://assets.imgix.net/gif-examples/imgix-logo-ani.gif?fm=mp4&w=620&h=349&fit=crop" type="video/mp4" />
</video>

png

The PNG file format is a lossless format. It does support transparency. It does not support animation.

The PNG file format is a common graphics format, often used for application assets.

Setting fm=png when the input file is a PNG will serve as an alias to fm=png8 or fm=png32. The output format in that case will match the input format.

png8

A variant of the PNG format with 8-bit transparency and palette-based color. It can be used for uniform computer-generated graphics in certain scenarios without compromising color accuracy. It works well with small images like icons and on webpages where full transparency support is necessary but a 32-bit PNG would be too heavy.

png32

The most common PNG variant with 24-bit color and an 8-bit alpha channel. You likely want to use this output format instead of fm=png8.

webp

The WebP file format is a lossy image format, but supports lossless compression. It does support transparency. It does support animation.

WebP can be either a lossless or a lossy image file format. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller in size compared to JPEG images.

WebP also supports lossless compression and alpha transparency with a notable reduction in file size compared to PNG. To have a WebP file delivered as lossless, set lossless=true.

Converting animated GIFs to WebP will produce WebP Animations. The conversion will take place automatically when using auto=format on supported browsers.

For a list of browsers that support WebP, please see the WebP section on caniuse.com. If auto=format is set and the browser does not support the WebP format, imgix will fall back to any format specified by the fm parameter, and finally the source image type.