remagicaDocs home
API referenceSprites

Preview a sheet import

POST
/sprites/imports/preview

Needs a key withsprites:read

Reads a sheet you uploaded without importing anything: its ground (clear, a key colour or neither), its grid (found from its gutters and the figures' spacing, or yours completed), the empty cells, frames per row, a suggested mapping of rows to actions and directions, what the master frame measures and warnings in plain words (mixed sizes, too many colours, feet off the baseline, figures cut off).

Requires scope sprites:read.

Authorization

apiKey
headerx-api-key<token>

An API key of your workspace (rmg_…), created in the web app. It acts for that workspace, not for a person, and keeps working when its creator leaves.

Request Body

application/json
  1. body
characterId?string

The character it would go to: its actions are offered. Left out: a new character's standard actions.

Length1 <= length <= 128
gameId*string
Length1 <= length <= 128
grid?

Your grid. Left out: it's found from the sheet.

image*

An image you uploaded.

key?|

The background colour to take out, as #rrggbb; null keeps every pixel. Left out: the sheet's own ground is found (a flat colour round its border).

masterFrom?

The frame the master is made from. Left out: the first row's first frame for a new character, and the character's own master otherwise.

rows?array<>

Your mapping so far, for its warnings. Left out: the suggested one.

Itemsitems <= 32

Response Body

What the sheet is and how it would import.

application/json
  1. response
actions*array<>

The actions a row can be (the character's, or the standard ones).

background*

The sheet's ground: clear (alpha), a flat colour (key, with its hex) or neither (none).

cells*integer

Cells in the grid.

directions*array<>

Directions a row can be: the camera's drawn ones (left-facing ones are flipped on export).

emptyCells*array<integer>

Cells with no figure, as row × cols + col.

grid*

The grid, in sheet px.

height*integer
key*|

The colour that would be taken out, or null.

measurements*

What the sheet measures.

rowFrames*array<integer>

Frames (cells with a figure) in each row.

rows*array<>

The suggested mapping, a row each.

warnings*array<string>

In plain words: mixed sizes, too many colours, feet off the baseline, figures cut off.

width*integer
Example Request
curl -X POST 'https://api.remagica.com/api/v1/sprites/imports/preview' \  -H 'Content-Type: application/json' \  -d '{  "gameId": "5c2a9e1d-7b3f-4a6e-8d0c-2f1e3a4b5c6d",  "image": {    "key": "uploads/org_123/5d1c…/frame.png"  }}'
Example Response
{  "actions": [    {      "key": "generations/e661f4c9-5b3d-4f60-8e2a-1d9c6b4f7e05/0.png",      "name": "Autumn campaign"    }  ],  "background": {    "hex": "string",    "kind": "alpha"  },  "cells": 1,  "directions": [    "E"  ],  "emptyCells": [    1  ],  "grid": {    "cellH": 1,    "cellW": 1,    "cols": 1,    "gapX": 1,    "gapY": 1,    "offsetX": 1,    "offsetY": 1,    "rows": 1  },  "height": 1280,  "key": "generations/e661f4c9-5b3d-4f60-8e2a-1d9c6b4f7e05/0.png",  "measurements": {    "cell": [      0,      0    ],    "colourCount": 1,    "feetRow": 1,    "heightPx": 1,    "palette": [      "string"    ],    "widthPx": 1  },  "rowFrames": [    1  ],  "rows": [    {      "actionKey": "generations/e661f4c9-5b3d-4f60-8e2a-1d9c6b4f7e05/0.png",      "actionName": "string",      "direction": "E",      "frames": 1,      "row": 1    }  ],  "warnings": [    "string"  ],  "width": 1024}