Skip to content

Magic++: Expanded color map not written to file #45

Description

@HorstBaerbel

Using Magic++ 6.9.7.4+dfsg-16ubuntu6.4 amd64 on Ubuntu 18.04.2.
When I load a 8-bit paletted PNG, resize the color map and write to the file again the color map still has the same size, not the expanded size as expected. This also happens if I I set the expanded, previously unused entries.
Example code:

Image img;
img.read("in.png"); //<-- 8bit paletted file, 255 colors
std::vector<Color> colorMap;
for (size_t i = 0; i < img->colorMapSize(); ++i) {
    colorMap.push_back(img->colorMap(i));
}
img.colorMapSize(img.colorMapSize() + 1); //<--after this this the color map is actually 1 entry bigger
colorMap.push_back(Color("#ff00ff"));
for (size_t i = 0; i < colorMap.size(); ++i) {
    img->colorMap(i, colorMap.at(i));
}
img.write("out.png"); //<--image written has still 255 colors

I also tried calling img.modifyImage() before and img.syncPixels () afterwards, but that didn't change anything. There's no need to expand the color map. A simple swap of color map entries refuses to work for me...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions