Loading in a PNG messes with the palette

Hey all,
When loading a PNG into promotion and selecting “Choose current palette”, all the color rows get shifted to the right.
Additionally, if i try to shift things back the Remap colors function doesn’t work at all. (double bug… woooo)
Demo
I’m on the latest version. (7.2.7)

This is a known bug. It happens when opening a PNG with an alpha channel.
Flat PNGs will open properly, though.

Similar thread: Opening non-indexed image using current palette messes up palette order - #2 by jan.cosmigo

The reason for this is basically that PM works purely based on indexed colors. That means, that when loading alpha transparent (true color) images, there is still a color index that is considered to be used for full transparency. And this index should be white and is index 0 by definition.
Therefore it reserves color index 0 to be transparent and makes it white. All other colors are shifted one slot to the right.
This is done with either palette, a freshly generated one or the one that is pre-selected as you did.
I should be able to improve this to use the last color index (255) to be transparent instead.

I like the solution of the LAST color index being the designated transparency color instead of the first.
256 color palettes may lose a color but it’s necessary and this way all colors won’t be shifted one slot.

I’m already in the habit of reserving the last color for transparency in all my own palettes.

In my experience, and this is probably true for others - when I open an image and choose to use as existing palette to quantize it, I expect that carefully crafted palette to not be altered in any way. When the one slot shift happens you now have the unwanted task of “fixing” your palette before you can continue working, in many cases.

On a side note, It might also be nice to have a checkbox option in the quantize colors dialogue to not import the alpha map. I usually delete it immediately anyway. something like?:
image

Fixed with V8. Several detection mechanisms are now in place to check if index 0 can safely be used as a transparent color without shifting. If that doesn’t work, index 255 is used. If this color is in use then all pixels using that color are remapped to the next best matching color.

The “Import alpha” option has been added as well.

Sorry I never responded! thanks for the attention and adjustments!