[osg-users] imageio problems and possible solutions on loading some PNG images.

Robert Osfield robert.osfield at gmail.com
Thu Nov 26 06:07:48 PST 2009

HI Tat,

I don't have a OSX system to test against personally, but for those
who do have OSX and wish to help investigate this bug with the imageio
plugin it would be worth putting together a small set of test images
that you see problems so that they can reproduce the problem

Also if we can settle upon an existing OSG example or a small mod to
one that can help illustrate the issue then this would also help.  For
instance do you see the problem if you do something as simple as:

  osgviewer --image myimage.png


On Thu, Nov 26, 2009 at 1:12 PM, Tatsuhiro Nishioka
<tat.fgmacosx at gmail.com> wrote:
> Hi there,
> I have two problems in drawing PNG image using imageio on Mac OS X.
> One problem is that 16-bit grayscale textures (PNG images) cannot be loaded due to the following errors:
> <Error>: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 16 bits/pixel; 1-component colorspace; kCGImageAlphaLast; 512 bytes/row.
> <Error>: CGContextDrawImage: invalid context
> The cause of this is that CGBitmapContextCreate doesn't accept the combination of 1 component colorspace and 16bps. One solution I can think of at this moment is to create a bitmap context using RGBA colorspace (as the same as the 32bit RGBA image). This works fine on FlightGear but I'm not so sure if this works on all 16bpp images.
> Another problem is that imageio's libpng doesn't properly handle transparency in PNG file. The problem I have is that the transparency in PNG files are not at all handled and we see a lot of unexpected black or dark portions.  I strongly recommend the use of osgdb_png.so (or .dylib) for handling png images instead of imageio.
> More detail explanation, screenshots, and an experimental patch for solving these two problems are available from:
> http://macflightgear.sourceforge.net/home/development-notes/devnote-nov-26-2009
> Please try my patch and see if it also works on many OSG applications.
> FYI, I'm using OSG/svn as of a few day back on Mac OS 10.5.8 / intel.
> Best,
> Tat
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list