How to Turn Images Into Slideshow Videos using an API?

An image slideshow is perfect for showing off multiple pictures in video format. It's a popular format for social media videos, whether you want to feature real estate listings, display a series of pictures, or create a photo collection. You can create a dynamic image slideshow using a video editing API. Here's how to do it with just a single API call:

API Request
curl -s -X POST https://api.creatomate.com/v1/renders \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  --data-binary @- << EOF
{
  "source": {
    "output_format": "mp4",
    "width": 1920,
    "height": 1080,
    "elements": [
      {
        "type": "image",
        "source": "https://cdn.creatomate.com/demo/living-room.jpg",
        "track": 1,
        "duration": 5,
        "clip": true,
        "animations": [
          {
            "easing": "linear",
            "type": "scale",
            "scope": "element",
            "start_scale": "120%",
            "fade": false
          }
        ]
      },
      {
        "type": "image",
        "source": "https://cdn.creatomate.com/demo/bathroom.jpg",
        "track": 1,
        "duration": 5,
        "clip": true,
        "animations": [
          {
            "time": "start",
            "duration": 1,
            "easing": "cubic-in-out",
            "transition": true,
            "type": "slide",
            "fade": false,
            "direction": "180°"
          },
          {
            "easing": "linear",
            "type": "scale",
            "scope": "element",
            "start_scale": "120%",
            "fade": false
          }
        ]
      },
      {
        "type": "image",
        "source": "https://cdn.creatomate.com/demo/kitchen.jpg",
        "track": 1,
        "duration": 5,
        "clip": true,
        "animations": [
          {
            "time": "start",
            "duration": 1,
            "easing": "cubic-in-out",
            "transition": true,
            "type": "slide",
            "fade": false,
            "direction": "180°"
          },
          {
            "easing": "linear",
            "type": "scale",
            "scope": "element",
            "start_scale": "120%",
            "fade": false
          }
        ]
      },
      {
        "type": "image",
        "source": "https://cdn.creatomate.com/demo/house.jpg",
        "track": 1,
        "duration": 5,
        "clip": true,
        "animations": [
          {
            "time": "start",
            "duration": 1,
            "easing": "cubic-in-out",
            "transition": true,
            "type": "slide",
            "fade": false,
            "direction": "180°"
          },
          {
            "easing": "linear",
            "type": "scale",
            "scope": "element",
            "start_scale": "120%",
            "fade": false
          }
        ]
      }
    ]
  }
}
EOF
Output Video

How it works: In the example code above, we'll use cURL to call the REST API, but you can use any programming language you want to perform a similar API call. Here, we're using a JSON-based format to compose a video scene where several photos are featured for just a few seconds. With a slide effect, the photos smoothly transition between each other.

With the "duration" property, we ensure each photo remains visible for 5 seconds. We can also improve the slideshow's visual appeal by adding a zoom effect to each image, using the "animations" property. These animations can be completely customized to create a slideshow video with different effects.

All images need to be assigned to track number "1" so they appear in sequence. To include a logo or text caption, we can place those elements on a separate track number and position them in front.

If you want to create more advanced video slideshows, check out the online video editor below. It allows you to design your own slideshow videos, then export them as JSON for easy integration into your workflows.

Edit this Code Example in the Video Editor

Easily design your own video templates using the online editor. Then, export your templates as JSON and integrate them into your application to create any kind of video – completely through code.

Related API Video Editing Questions

Start automating today

Start with a full-featured trial with 50 credits, no credit card required.
Get started for free