2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Reported bugs that have been closed and/or resolved

Moderators: helmut, XnTriq, xnview, Dreamer

Post Reply
User avatar
Nurio
Posts: 10
Joined: Mon Mar 14, 2011 9:25 pm
Location: The Netherlands
Contact:

2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Post by Nurio »

XnView: 2.50.4 - 64-bit portable
OS: Windows 10 - 64-bit

When doing batch processing on PNGs with indexed colours, the palette gets shuffled around. As an input, I have one (or more) PNGs that have 16 indexed colours, and do batch processing to convert to a PNG with 256 colours to fill the rest of the palette with black. However, colours 1-15 in the palette are shuffled around. This only happens for Batch Processing. When exporting a single image as a 256-colour PNG through the Export dialogue, it keeps the order of the palette intact.

Effect: Palette gets shuffled, which messes up the colours for other images that rely on that same palette

To reproduce:
1. Have one or more PNGs with 16 indexed colors
2. Use Batch Processing on these PNGs
3. Convert to PNG with transformation: Convert to Colours (256, no dithering)
4. Overwrite the original PNG

Actual behaviour (bug): Color 0 is in the original position. Colors 1-15 are shuffled. Colors 16-255 are black

Expected behaviour: Color 0-15 are in the original positions. Colors 16-255 are black. (This does happen correctly when exporting a single image)

Original palette:
gimp-2.10_20220616-212908.png
gimp-2.10_20220616-212908.png (500 Bytes) Viewed 5462 times
Colors 0-15 of the new palette:
gimp-2.10_20220616-212925.png
gimp-2.10_20220616-212925.png (501 Bytes) Viewed 5462 times
Image
User avatar
Nurio
Posts: 10
Joined: Mon Mar 14, 2011 9:25 pm
Location: The Netherlands
Contact:

Re: 2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Post by Nurio »

UPDATE: After playing around a bit, I noticed that this doesn't happen if you also add a "Clear Metadata" (with everything checked) transformation before the "Convert to Colours" transformation. No idea why, though. But at least I can keep using XnView for this purpose right now

EDIT: No, turns out the Metadata thing has nothing to do with this. It was likely because I had done it with images edited and exported by GIMP, which don't have this issue. See below
Last edited by Nurio on Fri Jun 17, 2022 10:06 pm, edited 1 time in total.
Image
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Post by xnview »

please send me a sample file?
Pierre.
User avatar
Nurio
Posts: 10
Joined: Mon Mar 14, 2011 9:25 pm
Location: The Netherlands
Contact:

Re: 2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Post by Nurio »

I tried to create some sample files using GIMP, but interestingly, they didn't have this issue at all. Apparently only files I rip from this Pokémon mod have this issue. Here is one such file:
430 - Honchkrow - Original.png
430 - Honchkrow - Original.png (1.34 KiB) Viewed 5427 times
If you follow the steps above, you'll get a file with a shuffled palette. Of course the image itself still appears fine, because it gets updated to match the shuffled palette, but the issue is that in the game, for each Pokémon, there are three other forms that use the very same palette, and they get messed up because (for example) the colour with index 2 is now a different colour
Image
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Post by xnview »

:bugconfirmed: Thanks to your detailed description I can reproduce the problem.
Pierre.
User avatar
Nurio
Posts: 10
Joined: Mon Mar 14, 2011 9:25 pm
Location: The Netherlands
Contact:

Re: 2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Post by Nurio »

That's amazing news. I even see it got fixed already. Thank you!
Image
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Post by xnview »

This problem is supposed to be fixed in XnView MP 1.01. Please check and confirm the bug fix here.
Pierre.
User avatar
Nurio
Posts: 10
Joined: Mon Mar 14, 2011 9:25 pm
Location: The Netherlands
Contact:

Re: 2.50.4: Palette gets shuffled for indexed PNGs during batch processing

Post by Nurio »

I did some testing and it does seem to be fixed now! Thank you!
Image
Post Reply