Skip to main content
Lesson 4 of 12 · Create Videos with Grok

Animate an image with image-to-video

Lesson 4 of 12 Updated November 2, 2026 Intermediate
On this page
  1. Bring your images to life
  2. The image parameter
  3. Write a prompt when the image already speaks
  4. Three concrete examples
  5. Where this approach makes the difference
  6. Key takeaways

Updated November 2, 2026 based on the xAI video API reference: the source image goes in an image object ({"url": ...} or {"file_id": ...}), not as a plain string. Sources: Image-to-Video · Video Reference.

Bring your images to life

The xAI API doesn’t just generate videos from scratch. It can also animate an existing image—taking a visual you already own and putting it in motion. This feature, called image-to-video, changes the nature of the work: you’re no longer asking the model to invent a scene, you’re asking it to extend yours. This is exactly what you need for a product sheet that needs to turn into an ad, an editorial illustration intended for social media, or a brand visual already approved by a client.

The image parameter

Technically, it all comes down to adding an image object, which identifies the source visual by its url (public address or base64-encoded data) or by the file_id of a file uploaded via the Files API.

{
  "model": "grok-imagine-video",
  "prompt": "Animate this scene with a wind effect in the hair",
  "image": {"url": "https://exemple.com/photo-portrait.jpg"},
  "duration": 5
}

The model analyzes the provided image, preserves its visual content, and injects the movement described by the prompt. Three conditions govern this call: the image must be accessible (public URL, base64 data, or uploaded file), in JPEG, PNG, or WebP format, and the prompt must describe the desired movement rather than the image itself—the model already sees it, and redescribing it just wastes attention.

Write a prompt when the image already speaks

This is the most important shift in this lesson. In text-to-video, your prompt carries everything: subject, setting, style, action. In image-to-video, the first three are given, and you only need to work on the fourth. A good animation prompt therefore looks like a director’s note addressed to a director of photography who already has the set in front of them.

Focus first on what needs to move, naming the element and the nature of the gesture: “the leaves rustle gently in the wind,” “the river water flows slowly,” “the character turns their head to the right.” You can then add a layer of dynamic ambiance, which doesn’t concern a specific object but the general atmosphere—“sunlight gradually filtering through the clouds,” “light rain starting to fall.” Two habits to unlearn: don’t redescribe the image (“a mountain landscape” adds nothing) and don’t request a radical transformation of its content—that’s not what this endpoint does.

Three concrete examples

A product photo, say a watch resting on a velvet cushion, lends itself to a simple mechanical movement and a play of light. The square format suits the social feed it’s intended for.

{
  "model": "grok-imagine-video",
  "prompt": "Slow rotation of the watch on itself, light reflections sparkling on the dial",
  "image": {"url": "https://exemple.com/montre.jpg"},
  "duration": 5,
  "aspect_ratio": "1:1"
}

A landscape—here a mountain lake at dawn—allows for several simultaneous movements, provided they remain slow and natural. The longer duration is justified because the dissipating mist is an effect that needs time to read.

{
  "model": "grok-imagine-video",
  "prompt": "Slight ripples on the lake surface, morning mist dissipating slowly, birds crossing the sky",
  "image": {"url": "https://exemple.com/lac-montagne.jpg"},
  "duration": 8,
  "aspect_ratio": "16:9"
}

A portrait, finally, calls for restraint: a few seconds are enough, and the movement must remain microscopic or risk tipping into the uncanny. The vertical format prepares it for publication as a story.

{
  "model": "grok-imagine-video",
  "prompt": "The person blinks gently and smiles slightly, hair moving with a light breeze",
  "image": {"url": "https://exemple.com/portrait.jpg"},
  "duration": 3,
  "aspect_ratio": "9:16"
}

Where this approach makes the difference

Image-to-video finds its natural ground wherever existing visual assets already exist. In e-commerce, it turns a photo catalog into an inventory of video ads without a new shoot. On social media, it breathes new life into static posts that are plateauing in engagement. In presentations, it animates slides and illustrations that would never have justified a production budget. And for creative work, it allows you to explore animated variants of the same work at a negligible cost.

Three limitations temper this enthusiasm, and it’s best to know them before promising a result. The model generally respects the composition of the source image, but distortions can appear on fine details—typography, hands, repetitive patterns. Complex movements, like a character walking or a vehicle accelerating, are significantly harder to achieve than subtle movements of wind, water, or light; steer your requests toward the latter. Finally, the quality of the result depends closely on the resolution of the source image: a mediocre visual in input will never produce a clean video in output.

Key takeaways

  • The image parameter accepts a URL to the image to animate
  • The prompt must describe the movement, not the image
  • Subtle movements (wind, water, light) yield the best results
  • Image-to-video is ideal for e-commerce and social media
  • The quality of the source image directly impacts the result