Developer documentation
Generating tools
5 tools. Every change a tool makes is one undo step in SpriteGrid.
list_generation_stylesRetro Diffusion styleslooks only
The Retro Diffusion styles generate and animate_layer can use: each one's id, name, family (RD Fast is quick and cheap, RD Pro the best, RD Mini for tiny sprites, Animate Drawing brings a drawing to life), the sizes it draws and what it's for; and what's left on the account. Free. Needs a Retro Diffusion account connected in SpriteGrid.
Parameters
kindstringJust this kind: "image", "animation" or "tileset". Leave it out for all.
Returns
balancestringrequiredWhat's left on the Retro Diffusion account, like "$9.51", or null if it isn't known.
styleslist of objectsrequired12 fields
idstringrequiredPass it (or "Family Name", or just the name) as `style`.
namestringrequiredfamilystringrequiredThe model family: RD Fast (quick, cheap), RD Plus, RD Pro (the best), RD Mini (tiny sprites), Animate Drawing (brings a drawing to life), New Animation, RD Tileset.
kindstringrequiredimage, animation or tileset.
minWidthintegerrequiredThe narrowest picture it draws. A smaller area is drawn bigger and shrunk to fit.
maxWidthintegerrequiredminHeightintegerrequiredmaxHeightintegerrequiredanimatesDrawingbooleanrequiredTrue if it animates a drawing on a layer (use
animate_layer), false if it makes one from the prompt.frameCountslist of integersrequiredThe animation lengths it makes, in frames, if it can be chosen.
descriptionstringrequiredexamplePromptstringrequiredA prompt that shows what to write, if Retro Diffusion gives one.
generation_pricePrice a generationlooks only
What a generate, animate_layer or remove_background call would cost, without making anything: pass the same arguments you'd pass it. Free.
Parameters
whatstringrequired"generate", "
animate_layer" or "remove_background".stylestringWhich style: its id from
list_generation_styles, its family and name ("RD Pro Default") or just its name ("Default": the cheapest family that draws at the size).areaobjectFor generate: the area it fills. Leave it out for the whole canvas.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
framesintegerFor animations: how many frames.
startFromstringFor generate: "nothing", "layer" or "canvas".
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.
Returns
pricestringrequiredWhat it would cost, like "$0.02".
dollarsnumberrequiredThe same in US dollars, as a number.
balancestringrequiredWhat's left on the account, or null if it isn't known.
stylestringrequiredThe style it would use.
widthintegerrequiredThe size Retro Diffusion would be asked for (bigger than the area when it's drawn bigger and shrunk to fit).
heightintegerrequired
generateGenerate pixel art
Draws pixel art from a prompt with Retro Diffusion onto a new layer, filling an area of the canvas exactly (a style that can't draw that small draws it bigger, and it's shrunk to fit with whole pixels). With an animation style, the new layer is animated (the document becomes an animation if it isn't one). startFrom redraws what's there: the layer's drawing or the whole canvas, strength saying how freely. One undo step. Needs a Retro Diffusion account connected in SpriteGrid (not_connected if there isn't one). It costs a few cents of the user's credit (generation_price says how much, for free) and can take a minute or two; the user sees it being made on the canvas.
Parameters
promptstringrequiredWhat to draw: the subject, like "a red potion bottle". The style takes care of the look, so leave out "pixel art".
areaobjectWhere it goes, and its size. Leave it out for the whole canvas.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
stylestringWhich style: its id from
list_generation_styles, its family and name ("RD Pro Default") or just its name ("Default": the cheapest family that draws at the size). Leave it out for a plain style that draws at the area's size.startFromstringWhat it starts from: "nothing" (the default: the prompt alone), "layer" (the layer's drawing in the area) or "canvas" (everything the canvas shows there). Styles that animate a drawing start from the layer.
strengthnumberHow far it may move from what it starts from: 0 hardly at all, 1 freely. Leave it out for 0.6.
framesintegerFor an animation style that takes one: how many frames (4, 6, 8, 10, 12 or 16). Leave it out for 8.
usePalettebooleanTrue to use only the document's palette colors.
transparentbooleanTrue (the default) for a see-through background.
tilebooleanTrue to make it tile seamlessly (textures, floors).
seedintegerThe same seed and arguments draw about the same picture. Leave it out for a new one each time.
layerNamestringThe new layer's name. Leave it out for one from the prompt.
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.layerstringThe layer it starts from (with startFrom layer); the new layer goes above it. Leave it out for the layer selected in SpriteGrid.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat was made, in a line.
layerstringrequiredThe new layer's id.
placedobjectrequiredWhere its pixels are on the canvas (on the frame shown, for an animation), or null if none landed on it.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
framesintegerrequiredHow many frames: 1 for a picture.
stylestringrequiredThe style used.
coststringrequiredWhat it cost, like "$0.02".
balancestringrequiredWhat's left on the account, or null if it isn't known.
animate_layerAnimate a drawing
Brings a layer's drawing to life with Retro Diffusion (walking, idle, jumping, attacking, turning...: list_generation_styles kind animation, the ones that animate a drawing): the frames go on a new animated layer over it, around the drawing (or the selection's part of it) with room to move, and the layer is hidden. The document becomes an animation if it isn't one. One undo step. Needs a Retro Diffusion account connected in SpriteGrid (not_connected if there isn't one). It costs a few cents of the user's credit (generation_price says how much, for free) and can take a minute or two; the user sees it being made on the canvas.
Parameters
stylestringThe motion: a style's name ("Walking", "Idle", "Jump", "Attack"...) or id. Leave it out for Idle.
promptstringMore about the motion, like "swinging a sword". Optional.
framesintegerHow many frames (4, 6, 8, 10, 12 or 16), for styles that take it. Leave it out for 8.
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat was made, in a line.
layerstringrequiredThe new layer's id.
placedobjectrequiredWhere its pixels are on the canvas (on the frame shown, for an animation), or null if none landed on it.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
framesintegerrequiredHow many frames: 1 for a picture.
stylestringrequiredThe style used.
coststringrequiredWhat it cost, like "$0.02".
balancestringrequiredWhat's left on the account, or null if it isn't known.
remove_backgroundRemove a background
Makes a layer's background see-through with Retro Diffusion (for a picture brought in with a solid background): the result goes on a copy above it, and the layer is hidden. Works on layers without animation frames. One undo step. Needs a Retro Diffusion account connected in SpriteGrid (not_connected if there isn't one). It costs a few cents of the user's credit (generation_price says how much, for free) and can take a minute or two; the user sees it being made on the canvas.
Parameters
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat was made, in a line.
layerstringrequiredThe new layer's id.
placedobjectrequiredWhere its pixels are on the canvas (on the frame shown, for an animation), or null if none landed on it.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
framesintegerrequiredHow many frames: 1 for a picture.
stylestringrequiredThe style used.
coststringrequiredWhat it cost, like "$0.02".
balancestringrequiredWhat's left on the account, or null if it isn't known.