Gimp-Forum.net
How to prevent GIMP from rearranging colour map? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: How to prevent GIMP from rearranging colour map? (/Thread-How-to-prevent-GIMP-from-rearranging-colour-map)



How to prevent GIMP from rearranging colour map? - Malvineous - 03-26-2021

Hi all,

I have a 256-colour indexed image I generated with a program I am working on.  I want to load it in GIMP, modify a few pixels, and then save it again.

However when I do this, GIMP rearranges the colour map, swapping entries 0 and 1.  When I read the image back with my program, these two colours appear wrong as they are supposed to match an existing external palette.

If I use the "Colors | Map | Rearrange Colormap" option to swap entries 0 and 1 to put them back in their original order, when I save the file and reload it I find that GIMP has put them back the wrong way around.

If I load and save the file with the colours the wrong way around GIMP leaves them alone!

I cannot work out how to get GIMP to save the file without rearranging the palette.

Am I doing something wrong?  I'm using GIMP 2.10.22 and this is the file I am trying to edit.  Entry 0 is meant to be black and entry 1 is meant to be dark blue, which is shown when the image is first loaded, but it seems impossible to save the image like this, with black as 0 and blue as 1.

Any suggestions would be appreciated!


RE: How to prevent GIMP from rearranging colour map? - Ofnuts - 03-26-2021

Can only confirm the problem. Strangely if you use GIF instead of PNG the colormap isn't altered.

On the other hand your colormap is full (256 colors), so did you try with a slightly smaller colormap (which should be doable since the current one contains many duplicates)


RE: How to prevent GIMP from rearranging colour map? - rich2005 - 03-26-2021

I got the same results as Ofnuts. Gif keeps the order but png does not. But then the image only uses 43 of colours and that blue is not one of them.

Tried all sorts of things, came to the conclusion that for a simple edit then use something else.
mtpaint seems to keep the colormap. Your original edited in mtpaint and the edited image open in Gimp.
mtpaint is not something I normally use, running it here from my home partition, all the dependencies are already there from other programs. example: https://i.imgur.com/sleZruS.jpg

edit: one question out of curiosity. Where (which application) did the png come from originally?