Reference · Converting
pxart from-png
Convert PNGs (loose, a pack with a labels CSV, or one sheet sliced by --grid) to .px with exact pixels.
from-png A.png [B.png ...] [-o OUT.px] [--id PREFIX] [--prefix-dir] [--palette P.px] [--colors N] [--hard-edges] [--names A,B,... | --labels FILE.csv [--label-col proposed_name] [--file-col filename]] from-png SHEET.png --grid WxH [--names A,B,...] [--by rows|cols] [-o OUT.px] [--id PREFIX] [--palette P.px] [--colors N] [--hard-edges]
usage: pxart from-png [-h] [-o O] [--id ID] [--palette PALETTE] [--colors N] [--hard-edges]
[--grid WxH] [--names A,B,...] [--labels FILE.csv] [--label-col COL]
[--file-col COL] [--by rows|cols] [--prefix-dir]
pngs [pngs ...]
from-png A.png [B.png ...] [-o OUT.px] [--id PREFIX] [--prefix-dir] [--palette P.px] [--colors N]
[--hard-edges] [--names A,B,... | --labels FILE.csv [--label-col proposed_name] [--file-col filename]]
from-png SHEET.png --grid WxH [--names A,B,...] [--by rows|cols] [-o OUT.px] [--id PREFIX] [--palette P.px]
[--colors N] [--hard-edges]
Convert PNGs (loose, a pack with a labels CSV, or one sheet sliced by --grid) to .px with
exact pixels.
positional arguments:
pngs
options:
-h, --help show this help message and exit
-o O
--id ID
--palette PALETTE new OUT imports this palette file and reuses its keys (a sprite's palette: palette SPRITE --extract-to P.px first)
--colors N reduce the PNGs (all together) to OUT's palette colors and at most N new ones first (0: OUT's only), for a photo or painting with more colors than palette keys; says how far that moved them and how many colors are OUT's
--hard-edges make every see-through px opaque (alpha 128 and up) or clear (under 128) first, before --colors: on/off edges, no see-through keys
--grid WxH slice one sheet into WxH cells, one frame each (empty ones skipped)
--names A,B,... one frame id per PNG, in order; with --grid: each row's (--by cols: column's) group name
--labels FILE.csv name each PNG from a CSV beside it: its --file-col row's --label-col (repeatable)
--label-col COL with --labels: the column of names (default proposed_name)
--file-col COL with --labels: the column of PNG file names (default filename)
--by rows|cols with --grid: a group per row (the default) or per column
--prefix-dir id each PNG FOLDER/STEM, FOLDER its directory's name (dungeon/tile_0002)
PNG -> .px with exact pixels. One PNG and no --id: a single unnamed grid. Several PNGs,
--id, or an existing OUT: frames named PREFIX/<png stem>, added to OUT (replacing same-id
frames, which the 'wrote' line names). Two PNGs of one run that would get one id (two packs'
tile_0002.png) are E_DUP_FRAME, naming both: --prefix-dir ids each one FOLDER/STEM by its
directory's name (dungeon/tile_0002, creatures/tile_0002). Colors already in OUT keep their
keys, so separate runs share one palette. --palette P.px starts a new OUT that imports P and
reuses its keys.
Naming loose PNGs: --names A,B,... gives one frame id per PNG, in order (as many names as
PNGs; '' skips one). --labels FILE.csv names them from a CSV, the way packs ship one
('filename,proposed_name,...'): each PNG takes the --label-col (default proposed_name) of
the row whose --file-col (default filename) names it, a path relative to the CSV's
directory, or else its file name alone. --labels repeats, one CSV per pack (with
--prefix-dir: dungeon/wall-stone-top, creatures/skeleton). A PNG no row names is E_SELECT.
--prefix-dir and --id PREFIX go in front of either.
--grid 16x16 slices one sheet into 16x16 cells, a frame each; a cell with no opaque pixel is
skipped. Each row of cells is a group (--by cols: each column), its cells left to right (top
to bottom) frames 0, 1, ...: --names names the groups in turn (an empty name skips its row),
else they are STEM/row0, STEM/row1 (col0, ...); --id PREFIX goes in front. A pack whose
columns are directions and rows are steps: 'from-png Walk.png --grid 16x16 --by cols --names
walk/down,walk/up,walk/left,walk/right -o boy.px' writes walk/down/0-3 and so on. A sheet
that isn't a whole number of cells is E_BAD_ARG, unless the strip left over is empty (then a
note says so).
Too many colors (a photo)? --colors N reduces them to OUT's colors and at most N new ones;
says how far. --hard-edges first: alpha 128+ opaque, the rest clear.
See also, in pxart help all: FORMAT: paths (what a path is read from: the current directory,
or a file's own).
pxart help all has the whole reference, pxart help TOPIC one part of it.This is the output of pxart help from-png. The other converting commands and their shared notes are in pxart help CONVERTING.
This page is built from
site/src/data/reference.json in the repository.Edit on GitHub