Generate with Motion 2.0 Using Generated Images

Example for generating a video from a generated image

Follow this recipe to generate video using text:

The guide will recreate the following functionality in the Web UI via API.

Sample Request

curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v1/generations-image-to-video \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <YOUR_API_KEY>' \
     --header 'content-type: application/json' \
     --data '
{
  "imageType": "GENERATED",
  "isPublic": false,
  "resolution": "RESOLUTION_480",
  "imageId": "8815cca4-4cf7-4f21-aec4-00f8977f61d5",
  "prompt": "A cat roaring like a tiger",
  "frameInterpolation": true,
  "promptEnhance": true,
	"elements": [
   	 {
    	 "akUUID": "ece8c6a9-3deb-430e-8c93-4d5061b6adbf",
    	 "weight":1
   	 }
  ]
}

Motion Control

Use the following fields in elementsto apply Motion Control as shown in the web app.

NameakUUID
Bullet Timefbed015e-594e-4f78-b4be-3b07142aaa1e
Crane Down5a1d2a6a-7709-4097-9158-1b7ae6c9e647
Crane Over Head1054d533-168c-4821-bd3d-a56182afa4f3
Crane Upc765bd57-cdc5-4317-a600-69a8bd6c4ce6
Crash Zoom Inb0191ad1-a723-439c-a4bc-a3f5d5884db3
Crash Zoom Out1975ac74-92ca-46b3-81b3-6f191a9ae438
Disintegrationa51e2e8d-ba5e-44f2-9e00-3d86fd93c9bc
Dolly Inece8c6a9-3deb-430e-8c93-4d5061b6adbf
Dolly Leftf507880a-3fa8-4c3a-96bb-3ce3b70ac53b
Dolly Out772cb36a-7d18-4250-b4aa-0c3f1a8431a0
Dolly Right587a0109-30be-4781-a18e-e353b580fd10
Explosion65da803d-c015-495a-8d5c-e969a79c9894
Eyes In148b50d0-2040-4524-a36f-6e330f9e362e
Flooda12c150e-95e9-469b-ba9b-6d5323ac5a09
Handheld75722d13-108f-4cea-9471-cb7e5fc049fe
Lens Crack193da194-2632-4f6a-a1df-d03ca9ae0ea9
Medium Zoom Inf46d8e7f-e0ca-4f6a-90ab-141d731f47ae
Orbit Left74bea0cc-9942-4d45-9977-28c25078bfd4
Orbit Rightaec24e36-a2e8-4fae-920c-127d276bbe4b
Robo Arm8df55fe2-5c6f-4dbf-8ade-eb997807ca0d
Super Dolly Ina3992d78-34fc-44c6-b157-e2755d905197
Super Dolly Out906b93f2-beb3-42be-9283-92236cc90ed6
Tilt Downa1923b1b-854a-46a1-9e26-07c435098b87
Tilt Up6ad6de1f-bd15-4d0b-ae0e-81d1a4c6c085

πŸ“˜

Weight

The upper and lower limit for the weightparameter is -2 to 2

πŸ“˜

Generating in 720p Resolution

To set resolution to 720p, apply RESOLUTION_720to the resolutionparameter.

πŸ“˜

Smooth Video

Applying frameInterpolation:trueis the same as applying Smooth Video from the Advanced Settings tab.

πŸ“˜

Image IDs of Generated Images

To get an image ID, first you need to generate an image using the Create a Generation of Images endpoint. You will get a Generation ID.

Then, use the generation ID as query parameter to the Get a Single Generation endpoint. You will get an array of images that looks like:

{
  "generations_by_pk": {
    "generated_images": [
      {
        "url": "https://cdn.leonardo.ai/users/ef8b8386-94f7-48d1-b10e-e87fd4dee6e6/generations/474e2e3a-4334-4c1d-bcbd-c73e4b86ba85/Leonardo_Lightning_XL_A_majestic_cat_in_the_snow_0.jpg",
        "nsfw": false,
        "id": "482a8f60-75cc-4911-94cf-10d624a62c76",
        "likeCount": 0,
        "motionMP4URL": null,
        "generated_image_variation_generics": []
      },
      {

In this case, the image ID is 482a8f60-75cc-4911-94cf-10d624a62c76.

Cost

The Image-to-Video endpoint costs 200 API Credits per 480p video, and 300 API Credits per 720p video.