Getting Started

​ ​Welcome

Blitline Job

Job Response

Job Options

Functions

Polling and Postbacks

Gotchas

Development Recommendations

Service Limits

Examples List

List of Available Functions

Output Options

S3 Destination

IAM Users

S3 Signed Url

Azure Destination

FTP Destination

Other Service Signed Urls

CDN

Advanced

Metadata

Colorspace

Color Extraction

Static IPs

Signed Jobs

Formats

Pipelines

Image Optimization

Smart Image

PDF

Fonts

Subimage

Special (Non-Image) Processing

AWS Rekognition/Facial Recognition

Apache Tika

Vector Processing

Animated GIFs

Screenshots of Websites

IM Scripts

Video Keyframes

Zipping

​ ​Trancoding Video Presets

​ ​Video Transcoding

Animated GIFs

Updated a month 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?