PNGConv is a PNG to ZX Spectrum Image Convertor. The aim is to allow you to perform image conversions from the command-line, primarily from within a makefile or batch file.
I developed it for use in my own ZX Spectrum projects, and it served its purpose. I put it here with no warranty. Maybe someone will find it useful.
This source code is released under the MIT License.
PngConv uses:
-
libpng 1.2.12
, released under the libpng License -
zlib 1.2.3
, release under the zlib License.
Both are included in this repository.
pngconv [options] input [output]
Detail:
|
This parameter is required and is the source .png file. There is no required format - the image will be converted internally to the correct format, providing the image can be read by pnglib. Masking for the output sprite is taken from the alpha channel of the input, or the specified colour. |
|
This is the output file. If this parameter is not given the output will default to "<input>.out". |
|
Display the help. |
|
Display version information. |
|
Silent mode. |
|
Origin of image to be pulled from the input. |
|
Size of the output image. Defaults to the size of the input. |
|
Format of the output mask: |
|
Take mask from the specified RGB colour (3 hex-digits). Overrides use of alpha channel for the mask. |
|
Invert the mask bits. |
|
Invert the image bits (default is black off, white on). |
|
Send output to stdout (console) rather than a file. |
|
Output as text. |
|
Set leading text to <db>. Defaults to "db ". Tab characters
can be entered using |
|
Set text output to Hex format, with optional leading char. |
|
Output as binary (default). |
|
Append output (default erases original output file). |
|
Output left-to-right (default), or right-to-left. |
|
ZigZag (alternate lines ltr/rtl). |
|
Output upside-down (bottom line first in memory). |
To convert a simple sprite image:
pngconv image.png image.out
To convert a sprite from a section of an image:
pngconv -pos=20,20 -size=16,16 image.png sprite.out
To output just the mask information:
pngconv -mask=m image.png mask.out
To output the mask information using purple as the mask:
pngconv -mask=m -mc=f0f image.png mask.out
To output the image data as text with "Data " leading:
pngconv -otxt -odb=Data\t image.png mask.out
To output alternate lines of inverted mask then byte, upside-down, zig-zagging the sprite, as text to stdout:
pngconv -mask=mmbb -imask -usd -zz -otxt -ostd image.png
To output a simple sprite to a hex text file, with leading char of #:
pngconv -otxt -ohex=# -odb=BYTE image.png image.out
To output two sections of an image into a single file:
pngconv -pos=0,0 -size=8,64 image.png image.out pngconv -pos=8,0 -size=8,64 -oapp image.png image.out