ImageMagick icon indicating copy to clipboard operation
ImageMagick copied to clipboard

define png:preserve-colormap not working/not implemented

Open CH4Code opened this issue 9 years ago • 8 comments

Hi,

in this thread I discuss an issue with .png files which have a colortable which uses an indexed palette. The problem is that ImageMagick, by default, reduces and reorders the colortable of an image.

Supposedly -define png:preserve-colormap suppresses that and should copy the colormap 1:1 to the processed image. However, it doesn't. This is bugged or not implemented (see discussion).

This is very important for working with sprite files which have to have an indexed palette for performance reasons. Not having this option makes ImageMagick useless for this scenario. Please fix!

CH4Code avatar Apr 02 '17 09:04 CH4Code

It would be good if this worked for the +remap option too. The scenario is that you have multiple images, possibly tiled, not tiled etc. you want to use / show together on a paletted display. You want those images to share a common palette of colors, with the SAME indices for each color entry. This is currently impossible, because ImageMagick (or the PNG encoder) tries to optimize the palette and only stores the colors needed for each individual image.

HorstBaerbel avatar Jan 20 '21 22:01 HorstBaerbel

Is this still not fixed?

faran-tenovos avatar Jul 07 '21 16:07 faran-tenovos

Also see #3719. This seems to have been implemented here and updated here. I haven't tried to use it in a while, but I have to agree that this is really useful and necessary for old DOS and console games (think Game Boy Color, Game Boy Advance etc.)

HorstBaerbel avatar Jul 07 '21 20:07 HorstBaerbel

I'm also stuck on this issue, this is for the OpenRCT2 project, here is the StackOverflow link: https://stackoverflow.com/questions/70546137/how-to-preserve-the-color-table-for-an-indexed-png-image

Any help would be appreciated. Thanks.

frutiemax avatar Dec 31 '21 23:12 frutiemax

As far as I know, ImageMagick might not preserve the color table. It will rearrange or add/subtract values depending upon the operation.

fmw42 avatar Dec 31 '21 23:12 fmw42

I've also noticed this bug.

On a PNG with indexed palette, convert in.png -flip out.png optimizes the palette; i.e. reduces duplicate palette entries and may re-order the palette.

convert in.png -define png:preserve-colormap -flip out.png actually converts it to non-indexed color. The expected behaviour would be to preserve the palette order.

tetracorp avatar May 20 '22 10:05 tetracorp

Hi,

I am experiencing this issue as well. The effects are exactly as tetracorp explained.

apposada avatar May 30 '22 22:05 apposada

Same issue here: I would like to preserve colormaps in Bitmaps as well.

v11 avatar Jun 30 '22 14:06 v11

Hello,

It has been a while but I was wondering if any advances have been made on this or if this has been noticed at all. Or likewise to know if somebody has managed to work with indexed pngs etc. Thanks.

apposada avatar Mar 20 '23 23:03 apposada

I've given up on this getting fixed. Moving away from Magick++ for my use case.

HorstBaerbel avatar Mar 21 '23 01:03 HorstBaerbel