Command Line Palette Processing?

slinga

Established Member
I'm trying to improve my sprite workflow. I need to the following:

1) Combine all of my sprites
2) Create a single optimized palette of 255 colors
3) Export that palette
4) Apply that palette to each of my sprites

So far I have this (using ImageMagick from the command line)

Code:
rm ALL.TGA
convert -append *.TGA  ALL.TGA
convert ALL.TGA -depth 8 -colors 255 ALL2.TGA

The append appends all of my sprites into a single file 24-bit color TGA. The next line creates an indexed (palette) TGA but instead of using 255 colors it uses ~16 or so.

I then need a way to extract the palette from ALL2.TGA and apply it to each of my sprites. Any advice on how to do this? Thanks in advance.
 
you can do this with Irfanview. it has command line options, and I think that includes palettes - it's free to use as well.

from i_options.txt:
/import_pal=palfile - import and apply a special palette to the image (PAL format)
/export_pal=palfile - export image palette to file (PAL format)

this is a script I made to open all .png images in a folder, convert them to 8bpp, and then export the .pal file - importing the palette should be similar.

@echo off
"C:\Program Files (x86)\IrfanView\i_view32.exe" /bpp=8 /export_pal="B:\SteamLibrary\steamapps\common\Sonic Mania\Data\Data\Images\TrueEnd.pal" /convert="B:\SteamLibrary\steamapps\common\Sonic Mania\Data\Data\Images\*.tga" /file="B:\SteamLibrary\steamapps\common\Sonic Mania\Data\Data\Images\TrueEnd.png"
 
Last edited:
Thanks for the fast response. I've been using IrfanView via the UI. I'll look into the command line option.
 
Back
Top