Skip to content

Image.palette modified after calling show() or save() #718

@zhyang-liu

Description

@zhyang-liu

When an Image object is using palette, calling method Image.save() and Image.show() modifies Image.palette and Image.palette.save() throws an exception ValueError: palette contains raw palette data. The figure below shows the code and the exception. Please take a look at lines that commented out and the console output number 768.

1

After uncommenting the show() method, the exception disappeared, and the length of palette.palette was still 768.
2

But when I only use the save() method and comment out the show() method, the length will be 600, as I specified colors=200 before.
3

I don't think a show() or save() method should modify the origin object, and I also think the palette of a converted palette picture should be able to save its palette directly, without saving or taking a glance at first.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions