SDL_image: Fix for inaccurate pixel colors (ImageIO backend)

Greetings,

I believe I may have found the cause of the SDL_image “pixel bug” that occurs on Mac OS X and (presumably) iOS when using the ImageIO backend (the default build for OSX, iOS platforms). I need your help to verify a patch I wrote. I would like to try getting this pushed upstream if it turns out that it does resolve the problem. The proposed bug patch can be found in SDL_image’s bug database as #2788 (https://bugzilla.libsdl.org/show_bug.cgi?id=2788). I’ve attached a simple test case I used for testing that you can use yourself in the bug report. General testing with a reply of your results would be greatly appreciated. Testing on iOS hardware hasn’t been done and would be nice, too.

The bug can be a show stopper for us anytime we need to rely on the actual pixel colors of a data source (file, stream, whatever), such as the case with color keys, height maps and other general image processing effects.

The reason for the inaccurate pixel data being returned when using Apple’s ImageIO backend is because the color is being adjusted (calibrated) with regards for color accuracy, which while may be a nice feature for image viewing, it generally does not bold well for game developers. (If the “feature” were to be of significant interest to people, an additional function could easily be added to the API).

Bug References

  1. “Pixel bug in Mac OS X” – https://forums.libsdl.org/viewtopic.php?p=30317
  2. “Perhaps again? Pixel bug in Mac OS X” – https://forums.libsdl.org/viewtopic.php?t=10013&sid=34e8ef7cf74074039495037c1a077025------------------------
    Cheers,
    Jeffrey Carpenter

Fixed, thanks!On Thu, Nov 27, 2014 at 7:12 PM, i8degrees wrote:

Greetings,

I believe I may have found the cause of the SDL_image “pixel bug” that
occurs on Mac OS X and (presumably) iOS when using the ImageIO backend (the
default build for OSX, iOS platforms). I need your help to verify a patch I
wrote. I would like to try getting this pushed upstream if it turns out
that it does resolve the problem. The proposed bug patch can be found in
SDL_image’s bug database as #2788 (
https://bugzilla.libsdl.org/show_bug.cgi?id=2788). I’ve attached a simple
test case I used for testing that you can use yourself in the bug report.
General testing with a reply of your results would be greatly appreciated.
Testing on iOS hardware hasn’t been done and would be nice, too.

The bug can be a show stopper for us anytime we need to rely on the actual
pixel colors of a data source (file, stream, whatever), such as the case
with color keys, height maps and other general image processing effects.

The reason for the inaccurate pixel data being returned when using Apple’s
ImageIO backend is because the color is being adjusted (calibrated) with
regards for color accuracy, which while may be a nice feature for image
viewing, it generally does not bold well for game developers. (If the
"feature" were to be of significant interest to people, an additional
function could easily be added to the API).

Bug References

  1. “Pixel bug in Mac OS X” –
    https://forums.libsdl.org/viewtopic.php?p=30317
  2. “Perhaps again? Pixel bug in Mac OS X” –
    https://forums.libsdl.org/viewtopic.php?t=10013&sid=34e8ef7cf74074039495037c1a077025

Cheers,
Jeffrey Carpenter


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org