Output Options

CDN

S3 Signed Url

S3 Destination

FTP Destination

Azure Destination

IAM Users

Other Service Signed Urls

Getting Started

Blitline Job

Welcome

Job Options

List of Available Functions

Examples List

Functions

Job Response

Polling and Postbacks

Service Limits

Development Recommendations

Gotchas

Advanced

Pipelines

Fonts

Smart Image

Static IPs

Formats

Colorspace

Color Extraction

PDF

Image Optimization

Metadata

Signed Jobs

Subimage

Special (Non-Image) Processing

Zipping

Trancoding Video Presets

Apache Tika

AWS Rekognition/Facial Recognition

Animated GIFs

Building Gifs or Videos from Images

Find Image on the Internet

Video Keyframes

Video Transcoding

Screenshots of Websites

IM Scripts

Vector Processing

Animated GIFs

Updated 8 months ago by Blitline Support

ANIMATED GIFS

Gif images are a different beast than regular images. They are encapsulated “programs” which run and animate an image. They cannot simply be “cropped” down to a new size because each frame must be “cropped”. Often times, GIFs are even smart enough to compress themselves so that only parts of the image are animated to make them smaller.

As such, they do not fit into the regular flow of Blitline. They must be handled specially, or they will just be output as static single files (usually the first image in the GIF).

Animated GIFs must be specified with a “src_type” : “gif”, and the function that operates on the gif must be specified in the “src_data” element:

For example:

{
                "application_id":"YOUR_APP_ID",
                "src":"https://s3.amazonaws.com/img.blitline/sample.gif",
                "postback_url" : "https://blitline.com/stats",
                "src_type" : "gif",
                "src_data" : {
                    "name" : "resize_gif",
                    "params" : {
                        "width" : 100,
                        "height" : 100
                    },
                    "save" : {
                        "image_identifier": "foo",
                        "s3_destination":{
                            "bucket":"bltemp.shortlife",
                            "key":"grumpy_squirrel/out/out.gif"
                        }
                    }
                }
            }

There are 3 operation we support for manipulating GIFs, you can find examples below.

RESIZE GIF

{
                "application_id":"YOUR_APP_ID",
                "src":"https://s3.amazonaws.com/img.blitline/sample.gif",
                "src_type" : "gif",
                "src_data" : {
                    "name" : "resize_gif",
                    "params" : {
                        "width" : 100,
                        "height" : 100
                    },
                    "save" : {
                        "image_identifier": "foo",
                        "s3_destination":{
                            "bucket":"bltemp.shortlife",
                            "key":"grumpy_squirrel/out/out.gif"
                        }
                    }
                }
            }

RESIZE GIF TO FIT

Forces a GIF to fit the particular dimensions, resizing the largest side to fit within the specified “width” or “height” while maintaining aspect.

{
                "application_id":"YOUR_APP_ID",
                "src":"https://s3.amazonaws.com/img.blitline/sample.gif",
                "src_type" : "gif",
                "src_data" : {
                    "name" : "resize_gif_to_fit",
                    "params" : {
                        "width" : 100,
                        "height" : 100
                    },
                    "save" : {
                        "image_identifier": "foo",
                        "s3_destination":{
                            "bucket":"bltemp.shortlife",
                            "key":"grumpy_squirrel/out/out.gif"
                        }
                    }
                }
            }

GIF OVERLAY

Overlays an image onto an animated gif.

{
                "application_id":"YOUR_APP_ID",
                "src":"https://s3.amazonaws.com/img.blitline/sample.gif",
                "src_type" : "gif",
                "src_data" : {
                    "name" : "resize_gif_to_fit",
                    "params" : {
                        "overlay_src" : ""
                    },
                    "save" : {
                        "image_identifier": "foo",
                        "s3_destination":{
                            "bucket":"bltemp.shortlife",
                            "key":"grumpy_squirrel/out/out.gif"
                        }
                    }
                }
            }

CONVERT GIF TO VIDEO FILE

Will take an animated GIF and turn it into an mp4 video.

You MUST provide an S3 Destination for gif_to_vid functionality.

{
            "application_id": "YOUR_APP_ID",
            "src": "https://s3.amazonaws.com/blitdoc/gifs/superbowl.gif",
            "src_type": "pre_process_only",
            "pre_process": [
              {
                "gif_to_vid": {
                  "loop_count": 4,
                  "s3_destination": {
                    "bucket": "bltemp.shortlife",
                    "key": "grumpy_squirrel/movified_gif_4.mp4"
                  }
                }
              }
            ]
          }

How did we do?