Frame Selection frame

Enables selection of a single frame or a range, to enable preview of the GIF file. Ranges can take three forms:

  • M-N: Selects frames M and N and all frames in between
  • M-: Selects frames from M through the end of the file
  • -N: Selects frames from 1–N

Single-Frame Outputs

Original
frame=1
frame=50&fm=jpg

Frame Range Outputs

frame=-40
frame=20-60
frame=40-

In addition to extracting a portion of the animation, you can extract metadata from the image with the fm=json parameter and use it for further operations. For example, this is the metadata from the above cartoon:

{
  "GIF": {
    "DelayTime":0.06,
    "UnclampedDelayTime":0.06
  },
  "Depth":8,
  "ColorModel":"RGB",
  "HasAlpha":true,
  "PixelHeight":240,
  "PixelWidth":320,
  "Output":{
    "Frames":38
  },
  "ProfileName":"sRGB IEC61966-2.1"
}

The most meaningful fields for animated GIFs are PixelHeight, PixelWidth, and Frames. They can be used as inputs for further calculations and operations, such as maintaining or changing the aspect ratio across a catalog of images or extracting a thumbnail preview of part of the animation. See our JSON tutorial for more information about using metadata this way.

See the API specification for more information about this parameter's value ranges and format.