fmw42 - Yep, unfortunately dithering options make no difference.
snibgo - Yeah, I can do this with several other tools, but the whole point was I needed it to be automated and scriptable.
Here's what I need the palette to be:
Here's what IM does:
Here's how I think -remap works in IM:
1. IM decodes the image passed by -remap
2. IM gathers a list of all
unique RGB values in the decoded image (pixel by pixel?)
3. IM builds a palette with RGB values found in step 2 and orders them (what order?)
4. IM applies the palette to the target image using whatever options the user provides (dither etc.)
The "problem" lies in steps 2 and 3.
2. When gathering the colours used in the -remap, IM just picks up each unique RGB value once. This is probably correct behaviour 99.999% of the time, it's just not for my purposes. I need it to take ALL the RGB values, in the order they appear, without removing duplicates.
3. When building the palette, IM uses some method I haven't figured out to index the palette. What I need it to do is take each RGB value in the order it finds them in the image, without rearranging them.
Outputting this indexed PCX is just the final step in a larger script. The rest of the script works absolutely fine. It's just a shame that IM can't manage the final step because it has no way to force the use of a palette - it can only "rebuild" a palette from an existing image, and the user has very little control over how it rebuilds it.