Spritesheets

Re-render a previously generated sprite animation from a new view: the same motion and timing, seen from a different angle (e.g. a front-facing walk cycle turned into the same walk seen from the back). Pass the `spritesheet_url` you received from `animateSprite`, `animateSpriteKeyframes`, `transferMotion`, `editSpritesheet` or an earlier call - it must be a spritesheet you generated within the last 7 days; arbitrary external images are not accepted - and, as `image` (URL or base64), the character exactly as it must appear in the new view: it becomes the first frame of the animation. To produce that image, call rotateSprite on the animation's first frame (or any image of the character) and pick the view you want. An optional `final_image` fixes the last frame (it defaults to the first frame, for cyclic or returning animations), and an optional `prompt` steers the result: the character's facing in the new view ("its back to the camera"), where the action goes ("the kick goes to the left of the frame"), or anything else about the motion. Runs on hydra (default) or hydra-plus (finer detail). The job result is the same sprite result as animateSprite (`spritesheet_url`, `video_url`, grid fields, optional GIF and frame URLs). The animation covers the source's own length (up to 5 seconds; a longer source is sped up to fit), so omit `duration` unless you need to change that. Credits are held for that length when the job is accepted, or for 3 seconds when it is shorter (a new view is a new generation, and hydra generates at least 3 seconds); the final charge is the model's rate × seconds of video generated, never more than was held, and the difference (or everything, if the job fails or is cancelled) is refunded. Pass an optional request_id to tag the result for later retrieval via listGenerations (type spritesheet). Requires an API key (user scope). The call returns 202 with a job id - poll getApiJob (pass wait 30 to long-poll) honouring poll_after_ms, until status is succeeded; its result field is exactly the response documented for this operation. Synchronous responses are deprecated but still supported: pass `async: false` to block until the result is ready and receive it as the response body. Synchronous calls run on the same queue: the response carries an X-Ludo-Job-Id header, and a job still running after 15 minutes comes back as 202 with the job instead of an error. Each account may have up to 50 generations queued or running at once via the API; a request beyond that returns 429 (code PENDING_JOBS_LIMIT).

Changed on
post/assets/sprite/rotate-spritesheet

Request

  • Base URL
    https://api.ludo.ai/api
  • Auth
    API key in header Authorization

Request body

spritesheet_urlstring required

URL of a spritesheet you generated in the last 7 days (returned by animateSprite, animateSpriteKeyframes, transferMotion or editSpritesheet as spritesheet_url). External URLs are not accepted.

imagestring required

The character exactly as it must appear in the new view, as a URL or base64. It becomes the first frame of the animation. rotateSprite produces one from the animation's first frame.

final_imagestring

Optional exact last frame (URL or base64). Defaults to the first frame, for cyclic or returning animations.

promptstring

Optional instructions - the character's facing in the new view ("its back to the camera"), where the action goes ("the kick goes to the left of the frame"), or anything else about the motion.

durationnumber float

Seconds of the source animation to re-render; a longer source is sped up to fit. Omit to use the source's own length, capped at 5 (recommended).

model'hydra' | 'hydra-plus'

Backing model. Only hydra and hydra-plus support new views.

loopboolean

Trim the animation at the beginning or end to create a seamless loop. Omit to keep the source spritesheet's setting.

cropboolean

Crop sprite frames to fit content. Results in smaller spritesheets but inconsistent frame sizes across different animations.

frames4 | 9 | 16 | 25 | 36 | 49 | 64

Number of frames in the output spritesheet. Omit to keep the source spritesheet's frame count. Allow about one second of duration per 16 frames - above that the model may not be able to produce them all.

frame_size32 | 64 | 96 | 128 | 192 | 256 | 384 | 0

Size of the sprite in pixels, not of the frame - it sets how big the character is drawn, and each frame also holds the space around it, so frames come out larger than this value. 0 is for maximum resolution. Omit to keep the source spritesheet's setting.

gifboolean

When true, generates an animated GIF from the spritesheet and returns it in gif_url. Disabled by default to reduce response time.

individual_framesboolean

When true, extracts each frame from the spritesheet as an individual image and returns the URLs in individual_frame_urls.

spritesheet_with_backgroundboolean

When true, also returns the spritesheet with background intact (before background removal). The with-background spritesheet URL will be in spritesheet_with_background_url.

use_pixel_gridboolean

Use the animation's pixel grid if one is detected. true: when Ludo detects a pixel grid with confidence, the sheet is packed on it (logical pixels, scaled up by whole blocks); when none is detected, this has no effect. false: always pack as ordinary art, for when the detected grid is wrong for your asset (for example a smooth sprite coming back as coarse blocks). Ignored for forge-pixel animations, which are always packed on their grid. Unset keeps the source spritesheet's setting (true unless it was made with false).

request_idstring

Optional client-provided identifier, unique per request. Re-sending the same request_id returns the existing job instead of generating again. Also usable as the request_id filter of listGenerations.

asyncboolean

Defaults to true: the call returns 202 immediately with a job id to poll with getApiJob. Set false for a synchronous response (deprecated but supported): the call then blocks until the result is ready.

Response

Success

spritesheet_urlstring
video_urlstring
audio_urlstring

URL of the sound effect generated for the animation (MP3 or WAV; the extension says which). hydra and hydra-plus only; absent for forge and forge-pixel.

gif_urlstring
individual_frame_urlsstring[]
num_framesinteger

Number of frames in the spritesheet.

num_colsinteger

Columns in the frame grid. Frames run left-to-right, top-to-bottom.

num_rowsinteger

Rows in the frame grid. The last row may be only partly filled.

spritesheet_with_background_urlstring
individual_frame_with_background_urlsstring[]
durationnumber float
loopboolean

The loop setting the sheet was made with. false is a one-shot animation (an attack, a death) that should play once in an engine.

out_of_frameboolean

true when Ludo detected the sprite running past the edges of the frame during the animation, so parts of it are cut off. It is a hint, not a guarantee: look at the frames. The cut is in the generated video, so adjustSpritesheet can't recover it. Call editSpritesheet with edit_mode "outpaint" to extend the frame beyond its borders, or generate again with a larger margin on the axis that was cut (margin_ratio_horizontal / margin_ratio_vertical).

bad_loopboolean

true when Ludo detected that the animation doesn't loop cleanly. It is a hint, not a guarantee. Call editSpritesheet with edit_mode "fix_loop" to repair the loop.

request_idstring
created_atinteger

Changes