Sometimes it's easier to edit your source graphics for NewGRFs in RGB color space. When compiling your NewGRF, these files have to be converted to TTD paletted 256-color images. Doing this for a single file is simple enough when using a decent image manipulation program - however, doing this from the command line is not so simple. Gimp looses some colors from the palette, and imagemagick ignores any unused palette colors and/or scrambles the order of the colors in the palette.
I've written this small Python program to overcome these issues. It reads (almost) any kind of image, then finds the best match from the dos/windows palette for each unique color (using euclidean distance), and writes the image into a new file. You can also overwrite the read image by using the same filename for the output image. Requires Python, and some python packages: Pillow, Numpy and Scipy.
Get it from http://dev.openttdcoop.org/projects/tiq
Usage:
python tiq.py inimage outimage
Required parameters:
inimage: The name of the input image
outimage: The name of the output image
Optional parameters:
--noact, -n: Don't use action colors. Default behaviour is to use action colors, but only if the source image has 1:1 color match for the action color.
--win, -w: Use the windows TTD palette. Default behaviour is to use the DOS palette.
--help, -h: Interactive help
TIQ - TTD Image Quantizer
Moderator: Graphics Moderators
Who is online
Users browsing this forum: No registered users and 17 guests