We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1503 - SDL_image cannot load monochrome or greyscale 8-bit PNG files
Summary: SDL_image cannot load monochrome or greyscale 8-bit PNG files
Status: RESOLVED FIXED
Alias: None
Product: SDL_image
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-23 08:57 UTC by pelya
Modified: 2013-03-10 14:26 UTC (History)
2 users (show)

See Also:


Attachments
2-color grayscale PNG (232 bytes, image/png)
2012-05-23 08:57 UTC, pelya
Details
8-bit greyscale (870 bytes, image/png)
2012-05-25 11:04 UTC, Adam Olsen
Details
bug 1503 fix (494 bytes, patch)
2013-03-06 10:05 UTC, q66
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pelya 2012-05-23 08:57:54 UTC
Created attachment 860 [details]
2-color grayscale PNG

Branch default, rev. 330:1230766039be
SDL_image will fail when trying to load the PNG file I've attached, it's in 2-color grayscale format.

I remember opening a very similar bug a while ago.
Comment 1 Adam Olsen 2012-05-25 11:04:24 UTC
Created attachment 861 [details]
8-bit greyscale

Here's an 8-bit greyscale that SDL_image also fails to load (reports "Out of memory").

SDL1.3 trunk of a few weeks ago, SDL_image trunk of today.
Comment 2 Adam Olsen 2012-05-25 11:47:57 UTC
I poked around and SDL_MasksToPixelFormatEnum only supports INDEX8 and RGB332, which isn't what IMG_LoadPNG_RW is asking for.

I'm not sure what the solution is here.  I don't see any greyscale formats listed in SDL_PIXELFORMAT_*.  Maybe the easiest is to pretend it's 8-bit indexed but with a no-op palette that can be ignored?
Comment 3 q66 2013-03-06 10:05:16 UTC
Created attachment 1058 [details]
bug 1503 fix

Hello, just attaching a fix here (by Lee "eihrul" Salzman) to make it noticed :)

DK
Comment 4 q66 2013-03-10 14:26:05 UTC
fixed in http://hg.libsdl.org/SDL_image/rev/9b6ceb2c4a3b