Skip to content

Avoid padding indexed PNG palettes #10028

Description

@Delgan

Hi.

Just a small feature request. Kind of niche use case so let me know if this is out-of-scope for Pillow.

Basically I'd like to save a PNG with bits=4 but with exactly 5 entries in the palette array. Currently, Pillow writes a 16-entry PLTE chunk regardless of the actual number of palette entries.

Could we imagine a small option such as palette_padding=False (default to True for retro-compatibility) to disable padding?

Note that this is permitted by the PNG specs and that Pillow reads these image well.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions