GET
/
transform

How to use

The max_frames transformation allows you to limit the number of frames loaded from an animated image, such as a GIF.

Pass the following query param to the API endpoint:

max_frames=n

Where:

  • n is the maximum number of frames to load.

For example: max_frames=10

Parameter

n: The maximum number of frames to load from the animated image. This parameter accepts positive integer values:

  • If the specified value is less than the total number of frames in the animation, only the first n frames will be loaded.
  • If the specified value is greater than or equal to the total number of frames, all frames will be loaded.

Effect of Max Frames Setting

  • Limits the number of frames processed from an animated image.
  • Can be used to reduce processing time and resource usage for large animations.
  • Useful for creating previews or thumbnails of animated images.
  • May affect the perceived smoothness or completeness of the animation if set too low.

This transformation is particularly useful when you want to optimize the processing of animated images or when you only need to work with a subset of frames from an animation.

Original Animated GIF (example with 20 frames)

URL : https://www.thunderimage.com/sample/yosemite.gif

Animated GIF Limited to 5 Frames

URL: /transform?url=https://www.thunderimage.com/sample/yosemite.gif&max_frames=5

Best Practices

  • Use max_frames when you need to reduce processing time or resource usage for large animations.
  • Consider the nature of the animation when setting the max_frames value to ensure important visual information is not lost.
  • For creating previews or thumbnails of animations, a lower max_frames value (e.g., 5-10) is often sufficient.
  • When using max_frames, be aware that it may affect the timing or flow of the original animation.
  • Combine max_frames with other transformations (like resizing or quality adjustments) for more comprehensive optimization of animated images.

Note

The max_frames transformation only affects animated images (such as GIFs). It has no effect on static images or other file types.

Authorizations

x-api-key
string
headerrequired

API key required for authentication

Query Parameters

url
string
required

The URL of the animated image to be transformed.

max_frames
integer

The maximum number of frames to load from the animated image.

Required range: x > 1

Response

200 - image/gif

The transformed animated image in GIF format.