You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are seeking guidance on "palette index exceeding num_palette" error after upgrade to libpng 1.6.44
We've recently upgraded our application from libpng 1.6.37 to 1.6.44 and have encountered an issue when writing indexed color PNGs. Specifically, we're receiving the error: "libpng error: Wrote palette index exceeding num_palette".
We've created a standalone application to reproduce this issue consistently, I have attached the folder containing the source code along with exe files generated for the respective version. Here are the details:
Input:
• We create an indexed image with values 1 through 10.
• We define a colormap with 10 entries (indices 0-9).
Output with libpng 1.6.37:
Actual Indexed data:
1 2 3 4 5 6 7 8 9 10
Colormap:
Index 0: R=0.2422 G=0.1504 B=0.6603
Index 1: R=0.2803 G=0.2782 B=0.9221
Index 2: R=0.244 G=0.4358 B=0.9988
Index 3: R=0.154 G=0.5902 B=0.9218
Index 4: R=0.0297 G=0.7082 B=0.8163
Index 5: R=0.1938 G=0.7758 B=0.6251
Index 6: R=0.5044 G=0.7993 B=0.348
Index 7: R=0.8634 G=0.7406 B=0.1596
Index 8: R=0.9892 G=0.8136 B=0.1885
Index 9: R=0.9769 G=0.9839 B=0.0805
**
Output with libpng 1.6.44:
Actual Indexed data:
1 2 3 4 5 6 7 8 9 10
Colormap:
Index 0: R=0.2422 G=0.1504 B=0.6603
Index 1: R=0.2803 G=0.2782 B=0.9221
Index 2: R=0.244 G=0.4358 B=0.9988
Index 3: R=0.154 G=0.5902 B=0.9218
Index 4: R=0.0297 G=0.7082 B=0.8163
Index 5: R=0.1938 G=0.7758 B=0.6251
Index 6: R=0.5044 G=0.7993 B=0.348
Index 7: R=0.8634 G=0.7406 B=0.1596
Index 8: R=0.9892 G=0.8136 B=0.1885
Index 9: R=0.9769 G=0.9839 B=0.0805 libpng error: Wrote palette index exceeding num_palette
Error Description:
The error occurs when writing the image data, specifically when encountering the value 10, which exceeds the highest valid palette index of 9. This use-case worked correctly with version 1.6.37 but is now causing errors with 1.6.44.
Seeking Your Insights on:
• Is libpng 1.6.44 enforcing stricter checks on palette index values compared to the previous version?
• Has there been a change in how indexed color PNGs are handled in the 1.6.44 release?
• Are there any known workarounds or best practices to address the discrepancy between our image data and palette indices?
We appreciate any insights or assistance the community can provide. Thank you for your time and expertise.
Thanks & Regards,
Ashish
The text was updated successfully, but these errors were encountered:
That's the way it was meant to work since the test was added in libpng1.5.
It was broken in 1.6.33 and the bug was identified by Adam Richter (in 2020) and fixed by his change 866fdf6, committed in January of last year, so in 1.6.41:
Dear libpng community,
We are seeking guidance on "palette index exceeding num_palette" error after upgrade to libpng 1.6.44
We've recently upgraded our application from libpng 1.6.37 to 1.6.44 and have encountered an issue when writing indexed color PNGs. Specifically, we're receiving the error: "libpng error: Wrote palette index exceeding num_palette".
We've created a standalone application to reproduce this issue consistently, I have attached the folder containing the source code along with exe files generated for the respective version. Here are the details:
Input:
• We create an indexed image with values 1 through 10.
• We define a colormap with 10 entries (indices 0-9).
Output with libpng 1.6.37:
Actual Indexed data:
1 2 3 4 5 6 7 8 9 10
Colormap:
Index 0: R=0.2422 G=0.1504 B=0.6603
Index 1: R=0.2803 G=0.2782 B=0.9221
Index 2: R=0.244 G=0.4358 B=0.9988
Index 3: R=0.154 G=0.5902 B=0.9218
Index 4: R=0.0297 G=0.7082 B=0.8163
Index 5: R=0.1938 G=0.7758 B=0.6251
Index 6: R=0.5044 G=0.7993 B=0.348
Index 7: R=0.8634 G=0.7406 B=0.1596
Index 8: R=0.9892 G=0.8136 B=0.1885
Index 9: R=0.9769 G=0.9839 B=0.0805
**
Testcode.zip
**
Output with libpng 1.6.44:
Actual Indexed data:
1 2 3 4 5 6 7 8 9 10
Colormap:
Index 0: R=0.2422 G=0.1504 B=0.6603
Index 1: R=0.2803 G=0.2782 B=0.9221
Index 2: R=0.244 G=0.4358 B=0.9988
Index 3: R=0.154 G=0.5902 B=0.9218
Index 4: R=0.0297 G=0.7082 B=0.8163
Index 5: R=0.1938 G=0.7758 B=0.6251
Index 6: R=0.5044 G=0.7993 B=0.348
Index 7: R=0.8634 G=0.7406 B=0.1596
Index 8: R=0.9892 G=0.8136 B=0.1885
Index 9: R=0.9769 G=0.9839 B=0.0805
libpng error: Wrote palette index exceeding num_palette
Error Description:
The error occurs when writing the image data, specifically when encountering the value 10, which exceeds the highest valid palette index of 9. This use-case worked correctly with version 1.6.37 but is now causing errors with 1.6.44.
Seeking Your Insights on:
• Is libpng 1.6.44 enforcing stricter checks on palette index values compared to the previous version?
• Has there been a change in how indexed color PNGs are handled in the 1.6.44 release?
• Are there any known workarounds or best practices to address the discrepancy between our image data and palette indices?
We appreciate any insights or assistance the community can provide. Thank you for your time and expertise.
Thanks & Regards,
Ashish
The text was updated successfully, but these errors were encountered: