JSON2Video API allows you to add images to your videos to create overlays, watermarks, backgrounds or slideshows. In this section we will provide some examples of using images.

Simple image

Let's create a very simple example with nothing else than a background image. For this, we will create a movie, with just one scene, and with an Image Element inside. The image is set to a duration of 10 seconds, so the scene and the movie will inherit the same duration.

{
    "resolution": "full-hd",
    "scenes": [
        {
            "elements": [
                {
                    "type": "image",
                    "src": "https://assets.json2video.com/assets/images/flower-bee.jpg",
                    "duration": 10
                }
            ]
        }
    ]
}

The resulting video is:

Simple watermark over video

In this example, we will add a watermark image on the top-right corner over a background video. The watermark will appear after 3 seconds and will stay visible for 5 seconds.

{
    "resolution": "full-hd",
    "scenes": [
        {
            "elements": [
                {
                    "type": "video",
                    "src": "https://assets.json2video.com/assets/videos/beach-01.mp4"
                },
                {
                    "type": "image",
                    "src": "https://assets.json2video.com/assets/images/sunglasses-emoji-small.png",
                    "start": 3,
                    "duration": 5,
                    "x": 1800,
                    "y": 20
                }
            ]
        }
    ]
}

Note that the image is a PNG with transparent background.

Scaled and rotated image

Images can be scaled up and down and can be rotated. The following example creates a movie with a background image and a rotating sunglasses emoji scaled up to 250x250 pixels.

{
    "resolution": "full-hd",
    "scenes": [
        {
            "elements": [
                {
                    "type": "image",
                    "src": "https://assets.json2video.com/assets/images/flower-bee.jpg",
                    "duration": 15
                },
                {
                    "type": "image",
                    "src": "https://assets.json2video.com/assets/images/sunglasses-emoji-small.png",
                    "x": 835,
                    "y": 575,
                    "scale": {
                        "width": 250,
                        "height": 250
                    },
                    "rotate": {
                        "angle": 360,
                        "speed": 1
                    }
                }
            ]
        }
    ]
}

The rotate property takes an angle and speed parameters to animate the rotation. In the example above, the settings mean "rotate 360 degrees in 1 second". The rotation continues during all the scene.

A speed value of zero means there is no animation and the image is statically rotated.

The output of the JSON above is:

Image slideshow

Creating an image slideshow is quite similar to create a video slideshow (Video Elements - Example 3). We will use scenes (one image per scene) and transitions between scenes.

{
    "resolution": "full-hd",
    "quality": "high",
    "scenes": [
        {
            "comment": "Scene #1",
            "transition": {
                "style": "circleopen",
                "duration": 1.5
            },
            "elements": [
                {
                    "type": "image",
                    "src": "https://assets.json2video.com/assets/images/london-01.jpg",
                    "duration": 10
                }
            ]
        },
        {
            "comment": "Scene #2",
            "transition": {
                "style": "wipeup",
                "duration": 1.5
            },
            "elements": [
                {
                    "type": "image",
                    "src": "https://assets.json2video.com/assets/images/london-02.jpg",
                    "duration": 10
                }
            ]
        },
        {
            "comment": "Scene #3",
            "transition": {
                "style": "fade",
                "duration": 1.5
            },
            "elements": [
                {
                    "type": "image",
                    "src": "https://assets.json2video.com/assets/images/london-03.jpg",
                    "duration": 10
                }
            ]
        }
    ]
}

The resulting video is: