Page 1 of 1

Remap colors from image without mixing the order.

Posted: 2016-12-31T10:16:11-07:00
by coolperez8
So, I'm trying to edit an old game and import a custom character. I have an image of the palette I need to use, and the images of the character. I use this command to apply the palette, but there seems to be a problem with the resulting image when I try to import it into the game.

Code: Select all

cv -gravity south "./fix/*.png" +repage -background "srgb(115,197,165)" -alpha remove -type palette -extent 32x32^
   +repage -depth 16 -alpha remove -dither None -map "./imagemagick/pal.bmp"^
   -type palette +write "./imagemagick/fixPALC/%%02d.bmp"
Here is the ImageMagick version information:

Code: Select all

Version: ImageMagick 6.9.3-4 Q16 x64 2016-02-13 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
The problem when I convert the image is that the palette gets mixed around. I tried using -map and -remap and neither of them did what I wanted. I need the palette to be in the certain order because of the way the game works, since it's in the wrong order the sprite looks strange in the game. Also, it might be worth noting that the command says "cv" instead of "convert". This is because for some reason I updated Windows 10 to the anniversary update, and even when I re-added the path it would still run Windows file system convert, so I went into imagemagick's directory and copy/pasted convert.exe and renamed the copy to cv.eve.

Re: Remap colors from image without mixing the order.

Posted: 2016-12-31T10:50:41-07:00
by fmw42
Are you sure it is the palette order and not the BMP format? I do not think that you can arrange the palette order in IM. If it is the BMP type, then try BMP3:output.bmp or BMP2:output.bmp

How did you arrange your colors in your color map image? Did you make a 1D image of the colors you wanted in the color table, such as

Code: Select all

convert xc:"color1" xc:"color2" ... xc:"colorN" +append colormapimage.png