Main Menu

News:

LINKS: Website | Steam | Wiki

Palette Conversion Script

Started by NeonCarbide, September 23, 2021, 12:51:06 AM

Previous topic - Next topic

NeonCarbide

Was just manually typing in palettes into .txts when I thought: 'Ya know, I should script this'

So I did

Here's a link to the script itself
https://gist.github.com/NeonCarbide/97bbf5d7ee105651c768b1171d249d83

The script is written in Python3, and requires the installation of the Pillow library
https://pillow.readthedocs.io/en/stable/installation.html

The script takes two arguments:

  • the filepath of the image to convert to a palette
  • the title of resulting .txt

Example: python3 rexpaint-palette-converter.py C:/Users/ASDF/Desktop/test.png TestPalette

The short of it is that the script takes a 1xN sized .png, N being the number of colours in the palette, and converts it into the .txt format that REXPaint uses for its palettes

The best place I've found for the 1xN palette .pngs is lospec.com/palette-list, otherwise they are very easy to make in Photoshop, Paint, etc.

I hope y'all can make some use of it ^-^

NeonCarbide

Forgot to mention, currently it works for sure with any palette with less than or equal to the 192 colours that REXPaint can display at one time

As for larger palettes, I have yet to do testing, but I do plan on adding the functionality to auto-split large palettes into multiple files

Kyzrati

#2
Hey thanks for sharing, NeonCarbide! I'll add a link from the Resources page as well :D

Edit: More recent requests for this feature, and finally another update to REXPaint, led me to include this as an automated feature in 1.70--just drop .gpl files in data/palettes and REXPaint will do the rest!
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon