LibreSprite icon indicating copy to clipboard operation
LibreSprite copied to clipboard

Exporting sprite sheet - libpng: Wrote palette index exceeding num_palette

Open pseiler opened this issue 3 years ago • 1 comments

LibreSprite version

Version 1.0 (AppImage)

Describe the bug

When I try to export a spritesheet, I get the following error:

libpng: Wrote palette index exceeding num_palette
Error saving frame 1 in the file "/home/user/tux.png"
To Reproduce
Expected behaviour

Download this libresprite file here.

OS/Hardware
  • Operative System: openSUSE 15.3 x86_64
  • CPU: some Intel i5
Additional context

Aseprite seems to have this bug already fixed. https://github.com/aseprite/aseprite/issues/2842

pseiler avatar Feb 27 '22 01:02 pseiler

I can reproduce this error consistently with the following steps:

  • Create a new indexed image, white background
  • Load the preset a64 palette (any palette will likely do, though I haven't tried them all)
  • Save the image as a png, error occurs

The problem appears to be the image is filled with an out-of-range palette index (but looks like it's full of index 0). Filling the entire canvas with the paint bucket before doing anything else will clear out the out-of-range color and prevent the error. If something is already drawn the magic wand tool is able to distinguish the color and select it, to identify areas to fill with a valid color.

tbsp avatar Sep 15 '22 03:09 tbsp