Welcome to Pyxi’s documentation!

pyxi is a small library for interfacing with PyxelEdit .pyxel files in an object-oriented manner. Currently it allows for viewing all attributes of a .pyxel file, modifying values, and repacking the file into its original format for use within PyxelEdit.

PyxelImage

class pyxi.image.PyxelImage(file: str)

Represents a .pyxel file.

Parameters:file (str) – Path to the file that you are opening.
Attributes
version:Version of PyxelEdit that was used to create the image file.
name:The name of the file.
settings:Local settings related to PyxelEdit configuration and the image file.
canvas:Settings related to the image canvas.
palette:The color palette (in hexadecimal values) used in the image file.
tileset:Settings related to the tile set.
animations:The individual animations built in the image file.
extract()

Extracts all the individual files from a .pyxel file and places them in a converted/<file_name> directory.

get_tile() → PIL.Image.Image

Merges layers and returns the image.

Returns:New PIL.Image.Image object.
merge_layers(skip_layers: List[Union[str, int]] = None, base_layer: int = 0) → PIL.Image.Image

Merges layer images onto the defined base layer and returns the new Image object.

Parameters:
  • skip_layers – Not implemented.
  • base_layer (int) – Changes the base layer to merge on.
Returns:

New PIL.Image.Image object.

save()

Packs the object into a .pyxel file and places it in the /exported directory.

to_dict() → Dict[KT, VT]

Returns a dictionary with original .pyxel docData.json keys.

Canvas

class pyxi.canvas.Canvas(data: Dict[str, Any])

Represents the canvas used in the PyxelImage.

Attributes
width:Number of columns in the image.
height:Number of rows in the image.
tile_width:Width in pixels of each tile.
tile_height:Height in pixels of each tile.
layer_count:Number of layers in the image.
layers:Individual Layer’s in the image.
to_dict() → Dict[KT, VT]

Returns a dictionary with original .pyxel docData.json keys.

Palette

class pyxi.palette.Palette(data: Dict[str, Any])

Represents the palette used in the PyxelImage.

Attributes
width:Number of columns in the palette..
height:Number of rows in the palette.
color_count:Number of unique colors in the palette.
colors:A dictionary containing an index key and hexadecimal value of each color. Value can be None.
to_dict() → Dict[KT, VT]

Returns a dictionary with original .pyxel docData.json keys.

Tileset

class pyxi.tileset.Tileset(data: Dict[str, Any])

Represents the tileset used in the PyxelImage.

Attributes
fixed_width:Whether the tileset has a fixed width or not.
tile_width:Width in pixels of each tile.
tile_height:Height in pixels of each tile.
tile_count:Number of individual tiles in the image.
columns:Number of columns in the tileset.
to_dict() → Dict[KT, VT]

Returns a dictionary with original .pyxel docData.json keys.

Animation

class pyxi.animation.Animation(n: int, data: Dict[str, Any])

Represents an individual animation used in the PyxelImage.

Attributes
frame_id:Index of the frame.
name:Name of the animation.
length:Number of frames in the animation.
base_tile:Which tile the animation begins on.
duration_multipliers:
 
frame_duration:Length in milliseconds that the frame will be displayed.
to_dict() → Dict[KT, VT]

Returns a dictionary with original .pyxel docData.json keys.

Layer

class pyxi.layer.Layer(n: int, data: Dict[str, Any])

Represents an individual layer used in the image Canvas.

Attributes
layer_id:Index of the layer.
name:Name of the layer.
blend_mode:Which blend mode us being used on the layer. Can be normal.
alpha:Transparency of the layer (0-255).
muted:Unknown.
soloed:Unknown.
tile_references:
 Individual references to each TileReference used by the layer.
to_dict() → Dict[KT, VT]

Returns a dictionary with original .pyxel docData.json keys.

Tile Reference

class pyxi.tile_ref.TileReference(n: int, data: Dict[str, Any])

Represents an individual tile reference used in a Layer.

Attributes
reference_id:Index of the reference.
index:Index of the tile; 1-based indexing is used here.
flipped:Whether the image is flipped on the X axis. Does not seem consistent?
rot:Unknown.
to_dict() → Dict[KT, VT]

Returns a dictionary with original .pyxel docData.json keys.