A small command-line palette format converter for pixel art palettes.
palette_converter.py converts between common palette formats (input) and exports into several output formats including swatch images.
Supported input formats:
.pal(JASC-PAL).ase(Adobe Swatch Exchange).txt(Paint.net palette).gpl(GIMP palette).hex(one hex color per line).png(reads unique colors from an image)
Supported output formats:
.pal(JASC RIFF PAL).act(Adobe Color Table).dpf(D-Pixed Palette).dib(Device Independent Bitmap).bmp(Bitmap swatch image).ico(Icon swatch).cur(Cursor swatch).gif(GIF swatch).gal(GraphicsGale).png(PNG swatch).tga(TGA swatch)
- Python 3.7+
Pillow(for image-based input/output formats)
Install with:
pip install Pillowpython palette_converter.py input.gpl output.act
python palette_converter.py input.hex output.pal
python palette_converter.py input.ase output.png
python palette_converter.py input.gpl --allinputcan be any supported source format.outputcan be any supported target format.--alltriggers export to all supported outputs.
Tests use pytest and Pillow.
Install dependencies:
pip install pytest PillowRun tests:
pytest -q- For
.palinput, the script reads JASC-PAL text format. - For
.pnginput, it extracts unique colors from the source image in order of appearance. - For
.paloutput, the generated palette is padded to 256 entries (per format requirements).
This project is licensed under the MIT License. See LICENSE for details.