SpriteGrid

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

kindstring

Just this kind: "image", "animation" or "tileset". Leave it out for all.

Returns
balancestringrequired

What's left on the Retro Diffusion account, like "$9.51", or null if it isn't known.

styleslist of objectsrequired
12 fields
idstringrequired

Pass it (or "Family Name", or just the name) as `style`.

namestringrequired
familystringrequired

The 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.

kindstringrequired

image, animation or tileset.

minWidthintegerrequired

The narrowest picture it draws. A smaller area is drawn bigger and shrunk to fit.

maxWidthintegerrequired
minHeightintegerrequired
maxHeightintegerrequired
animatesDrawingbooleanrequired

True if it animates a drawing on a layer (use animate_layer), false if it makes one from the prompt.

frameCountslist of integersrequired

The animation lengths it makes, in frames, if it can be chosen.

descriptionstringrequired
examplePromptstringrequired

A 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".

stylestring

Which 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).

areaobject

For generate: the area it fills. Leave it out for the whole canvas.

4 fields
xintegerrequired

Left edge, in pixels from the left of the canvas.

yintegerrequired

Top edge, in pixels from the top of the canvas.

widthintegerrequired

Width in pixels.

heightintegerrequired

Height in pixels.

framesinteger

For animations: how many frames.

startFromstring

For generate: "nothing", "layer" or "canvas".

documentstring

Which 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.

layerstring

Which layer: its id, or its exact name (describe_document lists them). Leave it out for the layer selected in SpriteGrid.

Returns
pricestringrequired

What it would cost, like "$0.02".

dollarsnumberrequired

The same in US dollars, as a number.

balancestringrequired

What's left on the account, or null if it isn't known.

stylestringrequired

The style it would use.

widthintegerrequired

The 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

promptstringrequired

What to draw: the subject, like "a red potion bottle". The style takes care of the look, so leave out "pixel art".

areaobject

Where it goes, and its size. Leave it out for the whole canvas.

4 fields
xintegerrequired

Left edge, in pixels from the left of the canvas.

yintegerrequired

Top edge, in pixels from the top of the canvas.

widthintegerrequired

Width in pixels.

heightintegerrequired

Height in pixels.

stylestring

Which 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.

startFromstring

What 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.

strengthnumber

How far it may move from what it starts from: 0 hardly at all, 1 freely. Leave it out for 0.6.

framesinteger

For an animation style that takes one: how many frames (4, 6, 8, 10, 12 or 16). Leave it out for 8.

usePaletteboolean

True to use only the document's palette colors.

transparentboolean

True (the default) for a see-through background.

tileboolean

True to make it tile seamlessly (textures, floors).

seedinteger

The same seed and arguments draw about the same picture. Leave it out for a new one each time.

layerNamestring

The new layer's name. Leave it out for one from the prompt.

documentstring

Which 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.

layerstring

The layer it starts from (with startFrom layer); the new layer goes above it. Leave it out for the layer selected in SpriteGrid.

Returns
documentstringrequired

The document's id.

revisionintegerrequired

Its revision after the change.

summarystringrequired

What was made, in a line.

layerstringrequired

The new layer's id.

placedobjectrequired

Where its pixels are on the canvas (on the frame shown, for an animation), or null if none landed on it.

4 fields
xintegerrequired

Left edge, in pixels from the left of the canvas.

yintegerrequired

Top edge, in pixels from the top of the canvas.

widthintegerrequired

Width in pixels.

heightintegerrequired

Height in pixels.

framesintegerrequired

How many frames: 1 for a picture.

stylestringrequired

The style used.

coststringrequired

What it cost, like "$0.02".

balancestringrequired

What'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

stylestring

The motion: a style's name ("Walking", "Idle", "Jump", "Attack"...) or id. Leave it out for Idle.

promptstring

More about the motion, like "swinging a sword". Optional.

framesinteger

How many frames (4, 6, 8, 10, 12 or 16), for styles that take it. Leave it out for 8.

documentstring

Which 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.

layerstring

Which layer: its id, or its exact name (describe_document lists them). Leave it out for the layer selected in SpriteGrid.

Returns
documentstringrequired

The document's id.

revisionintegerrequired

Its revision after the change.

summarystringrequired

What was made, in a line.

layerstringrequired

The new layer's id.

placedobjectrequired

Where its pixels are on the canvas (on the frame shown, for an animation), or null if none landed on it.

4 fields
xintegerrequired

Left edge, in pixels from the left of the canvas.

yintegerrequired

Top edge, in pixels from the top of the canvas.

widthintegerrequired

Width in pixels.

heightintegerrequired

Height in pixels.

framesintegerrequired

How many frames: 1 for a picture.

stylestringrequired

The style used.

coststringrequired

What it cost, like "$0.02".

balancestringrequired

What'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

documentstring

Which 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.

layerstring

Which layer: its id, or its exact name (describe_document lists them). Leave it out for the layer selected in SpriteGrid.

Returns
documentstringrequired

The document's id.

revisionintegerrequired

Its revision after the change.

summarystringrequired

What was made, in a line.

layerstringrequired

The new layer's id.

placedobjectrequired

Where its pixels are on the canvas (on the frame shown, for an animation), or null if none landed on it.

4 fields
xintegerrequired

Left edge, in pixels from the left of the canvas.

yintegerrequired

Top edge, in pixels from the top of the canvas.

widthintegerrequired

Width in pixels.

heightintegerrequired

Height in pixels.

framesintegerrequired

How many frames: 1 for a picture.

stylestringrequired

The style used.

coststringrequired

What it cost, like "$0.02".

balancestringrequired

What's left on the account, or null if it isn't known.