Gfx2Next

ZX Spectrum Next graphics conversion tool.

Converts an uncompressed 8-bit BMP or PNG file to the Sinclair ZX Spectrum Next graphics format(s).

Supported Formats

  • .nxb – Block
  • .nxi – Bitmap
  • .nxm – Map
  • .nxp – Palette
  • .nxt – Tiles
  • .spr – Sprites
  • .tmx – Tiled

Usage

gfx2next [options] srcfile [dstfile]

Options

-debugOutput additional debug information.
-fontSets output to Next font format (.spr).
-bitmapSets output to Next bitmap mode (.nxi).
-bitmap-yGet bitmap in Y order first. (Default is X order first).
-spritesSets output to Next sprite mode (.spr).
-tiles-file=Load tiles from file in .nxt format.
-tile-size=XxYSets tile size to X x Y.
-tile-repeatRemove repeating tiles.
-tile-yGet tile in Y order first. (Default is X order first).
-tile-ldwsGet tile in Y order first for ldws instruction. (Default is X order first).
-tiled-file=Load map from file in .tmx format.
-tiled-blank=XSet the tile id of the blank tile.
-block-size=XxYSets blocks size to X x Y for blocks of tiles.
-block-size=nSets blocks size to n bytes for blocks of tiles.
-block-repeatRemove repeating blocks.
-block-16bitGet blocks as 16 bit index for < 256 blocks.
-map-noneDon’t save a map file (e.g. if you’re just adding to tiles).
-map-16bitSave map as 16 bit output.
-map-ySave map in Y order first. (Default is X order first).
-bank-8kSplits up output file into multiple 8k files.
-bank-16kSplits up output file into multiple 16k files.
-bank-48kSplits up output file into multiple 48k files.
-bank-size=XxYSplits up output file into multiple X x Y files.
-bank-sections=name,…Section names for asm files.
-color-distanceUse the shortest distance between color values (default).
-color-floorRound down the color values to the nearest integer.
-color-ceilRound up the color values to the nearest integer.
-color-roundRound the color values to the nearest integer.
-colors-4bitUse 4 bits per pixel (16 colors). Default is 8 bits per pixel (256 colors).
Get sprites or tiles as 16 colors, top 4 bits of 16 bit map is palette index.
-pal-file=Load palette from file in .nxp format.
-pal-embedThe raw palette is prepended to the raw image file.
-pal-extThe raw palette is written to an external file (.nxp). This is the default.
-pal-minIf specified, minimize the palette by removing any
duplicated colors, sort
it in ascending order, and clear any unused palette entries at the end.
This option is ignored if the -pal-std option is given.
-pal-stdIf specified, convert to the Spectrum Next standard
palette colors.
This option is ignored if the -colors-4bit option is given.
-pal-noneNo raw palette is created.
-zx7Compress the image data using zx7.
-zx7-backCompress the image data using zx7 in reverse.
-megalzCompress the image data using MegaLZ optimal.
-megalz-greedyCompress the image data using MegaLZ greedy.
-z80asmGenerate header and asm binary include files (in Z80ASM format).
-sjasmGenerate asm binary incbin file (SjASM format).
-previewGenerate png preview file(s).

Examples

  • gfx2next.exe -tile-repeat -map-16bit -bank-16k -z80asm -bank-sections=rodata_user,rodata_user,BANK_52,BANK_53,rodata_user -preview tiles.png
  • gfx2next.exe -tile-repeat -map-16bit -colors-4bit -z80asm -bank-sections=rodata_user,BANK_17,BANK_17 tiles.png
  • gfx2next.exe -sprites -colors-4bit -pal-min -pal-ext -preview sprites.png
  • gfx2next.exe -bitmap -pal-std -preview titlescreen.png

Source Code

Available on Github

Compiling

gcc -O2 -Wall -o bin/gfx2next src/lodepng.c src/zx7.c src/megalz.c src/gfx2next.c

Credits

  • Ben Baker – Gfx2Next Author & Maintainer
  • Antonio Villena – ZX7b
  • Einar Saukas – ZX7
  • Jim Bagley – NextGrab / MapGrabber
  • Michael Ware –
    Tiled2Bin
  • Stefan Bylun –
    NextBmp / NextRaw
  • fyrex^mhm – MegaLZ
  • lvd^mhm – MegaLZ
  • Lode Vandevenne – LodePNG

Download

Gfx2Next (101 downloads)