Pyxel Edit Forum Archive
ArchiveFeature requests

.pyxel format documentation

S
swistakm
Apr 22, 2014 at 12:29 pm
Is it possible for .pyxel format to be made public? I would like to make command line interface in python to export and manage all my .pyxel assets automatically. Now every time I make change I must use pyxel GUI to export files and I can't automate this job.
Danik
Apr 24, 2014 at 4:46 pm
I'd rather not make it public as it's not totally stable yet. It's relatively simple though, it's a zip file containing a file called docData.json, a number of layer png's called layerN.png, and a number of tile png's called tileN.png.
The json file can look for example like so:

{
  "version": "0.3.106",
  "name": "Untitled",
  "tileset": {
    "fixedWidth": true,
    "tilesWide": 8,
    "tileWidth": 8,
    "tileHeight": 8,
    "numTiles": 4
  },
  "animations": {
    "0": {
      "frameDurationMultipliers": [
        100,
        100,
        100,
        100
      ],
      "baseTile": 0,
      "length": 4,
      "frameDuration": 100,
      "name": "Animation 1"
    }
  },
  "canvas": {
    "height": 80,
    "layers": {
      "0": {
        "alpha": 255,
        "blendMode": "normal",
        "tileRefs": {
          "17": {
            "flipX": false,
            "rot": 0,
            "index": 1
          },
          "18": {
            "flipX": false,
            "rot": 2,
            "index": 3
          },
          "27": {
            "flipX": false,
            "rot": 1,
            "index": 3
          },
          "28": {
            "flipX": true,
            "rot": 2,
            "index": 2
          }
        },
        "hidden": false,
        "name": "Layer 1"
      },
      "1": {
        "alpha": 255,
        "blendMode": "normal",
        "tileRefs": {
          "0": {
            "flipX": false,
            "rot": 0,
            "index": 0
          },
          "1": {
            "flipX": false,
            "rot": 0,
            "index": 0
          },
          "53": {
            "flipX": false,
            "rot": 0,
            "index": 0
          },
          "54": {
            "flipX": false,
            "rot": 0,
            "index": 0
          }
        },
        "hidden": false,
        "name": "Layer 0"
      }
    },
    "tileHeight": 8,
    "tileWidth": 8,
    "numLayers": 2,
    "width": 80
  },
  "palette": {
    "height": 2,
    "width": 9,
    "colors": {
      "0": "ff000000",
      "1": "ffffffff",
      "2": "ff9d9d9d",
      "3": "ffe06f8b",
      "4": "ffbe2633",
      "5": "ff493c2b",
      "6": "ffa46422",
      "7": "ffeb8931",
      "8": "fff7e26b",
      "9": "ffa3ce27",
      "10": "ff44891a",
      "11": "ff2f484e",
      "12": "ff1b2632",
      "13": "ff005784",
      "14": "ff31a2f2",
      "15": "ffb2dcef",
      "16": null,
      "17": null
    },
    "numColors": 18
  }
}


By the way, to repeat the last export operation you can use Ctrl/Cmd+Shift+X, it's not automated but a lot faster than using the GUI.
noio
Apr 28, 2014 at 12:35 pm
What a nice surprise that you chose such an intuitive file format. Knowing this it's possible to automate my whole animation workflow :). Much love.
Danik
Apr 28, 2014 at 8:23 pm
Thanks noio, glad to hear. :)