cpct_img2tileset

Converts an image file with a set of tile or sprite images into a CPCtelera C-array tileset along with arrays for all tiles/sprites.

Usage

cpct_img2tileset [options] [image_file]

Requisites

This scripts uses Img2CPC utility by Augusto Ruiz to convert the PNG file into screen pixel definitions.  This requires freeimage libraries to be installed under Linux and MacOSX (they are already included for Windows/Cygwin)

Description

This script converts an image file containing a set of tile or sprite definitions of the same size into 2 files (.c and .h) ready to be passed to the C compiler for inclusion into a program.  By default, this script converts the image into 4x4-pixel tiles.  This means that the script splits the whole image into 4x4-pixel individual images and converts each one of them into a tile.  You may change sizes by using -tw / -th command line modifiers.  Generated output contains screen-pixel-format defined arrays with all the individual sprites extracted from the image file.  It also contains an aditional array, named _tileset, with pointers to all generated tiles/sprites.  This tileset array may be optinally not generated with -nt | --no-tileset modifier.  To do the conversion, the script calls Img2CPC, which reads pixels one by one and transform them into the closest colour value from the defined Amstrad CPC palette.  If no palette is given to this script, standard Amstrad CPC palette is used (the one that is set when a CPC computer starts).  Provided image file may be a PNG, JPG, BMP, GIF or TIFF file.

Command line options

-pf | --palette-firmware <palete_array>Sets the Amstrad CPC palette to be used for the conversion as an array of firmware colour values (up to 16, in mode 0).  Values must be passed inside ‘{‘ ‘}’ and separated by spaces.  Following example sets mode 1 palette to Black, white, red and green colours, to convert the file tiles.png,
cpct_img2tileset -m 1 -pf { 0 26 6 18 } tiles.png
-nt | --no-tilesetDo not generate a tileset array containing pointers to generated sprites/tiles.
-oph | --output-palette-hardwareGenerate output palette array containing hardware values
-im | --interlaced-masksGenerates transparent sprites with interlaced masks using 0 as the default index of the palette colour to be considered transparent
-t | --transparent-index <index>Changes the colour index to be considered transparent and is used to generate masks.
-bn | --tiles-basename <name>Sets the basename that will be used as C identifier for tiles or sprites.  Default: g_tile
-m | --mode <cpc_graphics_mode>Sets the CPC Graphics mode the output data will be produced for (0, 1 or 2).  Default: 0.
-tw | --tile-width <pixels>Sets the width of a tile in pixels.  Default: 4.
-th | --tile-height <pixels>Sets the height of a tile in pixels.  Default: 4.
-h | --helpShows help information on the terminal.
Converts an image file with a set of tile or sprite images into a CPCtelera C-array tileset along with arrays for all tiles/sprites.
Close