[osg-users] Cant't read PNG image correctly?

87 views
Skip to first unread message

Mohammed Djeralfia

unread,
Jul 11, 2013, 3:07:50 PM7/11/13
to osg-...@lists.openscenegraph.org
I have a tiff image that I create from it an thumbnail with gdal_translate:
"gdal_translate.exe -outsize 300 400 -of PNG -ot byte -scale image.tif thumbnail.png"

than I load it on the earth(osgEarth) and it look correct:
[Image: http://forum.osgearth.org/file/n7581916/goodImage.png ]

But when I remove the no_data from the image (png):
"gdal_translate.exe --a_nodata 0 -of PNG -ot byte thumbnail.png thumbnail_no_data.png"

it look correct in the Windows viewer, but when I load it, I have a strange result:
[Image: http://forum.osgearth.org/file/n7581916/badImage.png ]

I tested my image with:osgviewer --image file.png and it look wrong.

I had attached my two images:
[Image: http://forum.osgearth.org/file/n7581916/tempView.png ]
[Image: http://forum.osgearth.org/file/n7581916/tempView_Hide.png ]

So what can be the probleme?THANKS.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55199#55199




Attachments:
http://forum.openscenegraph.org//files/tempview_hide_881.png
http://forum.openscenegraph.org//files/tempview_105.png


_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Robert Osfield

unread,
Aug 2, 2013, 5:53:07 AM8/2/13
to osg-...@lists.openscenegraph.org
Hi Mohammed,

I see the problem with the tempView_Hide.png, when running the OSG
with OSG_NOTIFY_LEVEL set to DEBUG the ong plugin outputs the message:

width=300 height=298 depth=8
color == PNG_COLOR_TYPE_GRAY

I checked the plugin and it does have code hadnling
PNG_COLOR_TYPE_GRAY so I would have expected it to be a supported
type. I'm not the author of the plugin so really just in the same
position as you as to how to go about debugging it further. It could
be a bug in libpng, or it could be a bug in the OSG's handling of this
specific variant of the png format.

The best I can recommend is working through the png plugin to see how
it's converting the data to see it's making an error somewhere.
Robert.

Alexandre Vaillancourt

unread,
Aug 2, 2013, 12:38:13 PM8/2/13
to OpenSceneGraph Users
As a side note, the tempView_Hide.png is not recognized format by Photoshop 6. And from what I've seen, tempView_Hide.png has two channels : Gray and Alpha, wheras tempView.png has only alpha.

From what I read, tif files have weird standards when it comes to transparency.

--
Alexandre Vaillancourt


2013/8/2 Robert Osfield <robert....@gmail.com>

Mohammed Djeralfia

unread,
Aug 2, 2013, 1:20:23 PM8/2/13
to osg-...@lists.openscenegraph.org
First THANK YOU for your answer :D

With the old photoshop I know that it does not work like he said Alexandre, but with the new one like CS5.1 the image is displayed correctly,
Both images tempView.png (http://forum.osgearth.org/file/n7581916/tempView.png) AND tempView_hide.png (http://forum.osgearth.org/file/n7581916/tempView_Hide.png)(with no_data) have the same channel=GRAY; BUT with the no_data we have a mask(in photoshop it is displayed like a channel) and I think that the osgPlugin(or the libtif) can not recognize it.

I am a newbie with osg but I will try to take a look on how it work the png plugins,
And if there is any idea or suggestion,I will be very grateful.

THANKS.
(http://forum.osgearth.org/file/n7581916/tempView_Hide.png)

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55736#55736

Alexandre Vaillancourt

unread,
Aug 2, 2013, 2:08:07 PM8/2/13
to OpenSceneGraph Users
Mohammed,

I tried with Photoshop CS6, win 7 32bit and I couldn't open it. You had more luck than I did :P

--
Alexandre Vaillancourt


2013/8/2 Mohammed Djeralfia <osgf...@tevs.eu>
Reply all
Reply to author
Forward
0 new messages