Grid Sage Forums

REXPaint => Everything REXPaint => Topic started by: NeonCarbide on September 23, 2021, 12:51:06 AM

Title: Palette Conversion Script
Post by: NeonCarbide on September 23, 2021, 12:51:06 AM
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 (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 (https://pillow.readthedocs.io/en/stable/installation.html)

The script takes two arguments:

Example:
Code: [Select]
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 (http://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 ^-^
Title: Re: Palette Conversion Script
Post by: NeonCarbide on September 23, 2021, 12:55:45 AM
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
Title: Re: Palette Conversion Script
Post by: Kyzrati on September 23, 2021, 02:01:06 AM
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 (https://www.gridsagegames.com/forums/index.php?topic=1686.0)--just drop .gpl files in data/palettes and REXPaint will do the rest!