Re: [osg-users] osg::Image pixel format conversion
i can think of that,thanks to my image convert (http://www.rasteredge.com/how-to/vb-net-imaging/), i am praised by my emplyer. :D -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53524#53524 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Image pixel format conversion
Hi, Imagine a Program which lets you do a wide variety of ways to edit, alter, enhance and process batch conversion of your pictures in just a few clicks. Batch Image converter is the easiest to use programs that can apply your desired option to all or selected pictures at once... Thank you! Cheers, Ryan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50139#50139 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Image pixel format conversion
Hi Robert- Yeah no worries, I just ended up mucking with the bits directly, I was just wanting to use built-in functions if they were available. For anyone searching with a similar issue (this was in Windows btw), I ended up just setting all of the alpha elements to 0xFF within my GL_BGRA image. I was going to take it to GL_BGR, but the CF_DIB clipboard format wants a 4-byte aligned width, so instead of padding or cropping the original captured image, I just kept it in a 4-byte per-element format. If you were to keep it in BGR and you don't have it properly aligned the image will be sheared and look very wrong. Thanks-- Baker robertosfield wrote: Hi Baker, On 7 November 2011 19:32, Bradley Baker Searles How would you use gluScaleImage to convert formats? It only takes one format parameter, and internally it uses that one format to compute the size of the before and after image? It seems suited only to scale the image, not change formats... Am I missing something? You are right I there is only one format parameter, I was thinking about the GLenum typeIn, typeOut parameters which are for the data type, so won't be suitable for your purpose. The include/osg/ImageUtils header contains a number help functions for processing image data so you could probably use this. However, if you know that you have GL_RGBA and GL_UNSIGNED_BYTE then it would be easier to write a quick converter function that flips the 0 and 2 bytes to give you GL_BGRA. Robert. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43818#43818 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Image pixel format conversion
Hi Baker, On 7 November 2011 19:32, Bradley Baker Searles bsear...@carsim.com How would you use gluScaleImage to convert formats? It only takes one format parameter, and internally it uses that one format to compute the size of the before and after image? It seems suited only to scale the image, not change formats... Am I missing something? You are right I there is only one format parameter, I was thinking about the GLenum typeIn, typeOut parameters which are for the data type, so won't be suitable for your purpose. The include/osg/ImageUtils header contains a number help functions for processing image data so you could probably use this. However, if you know that you have GL_RGBA and GL_UNSIGNED_BYTE then it would be easier to write a quick converter function that flips the 0 and 2 bytes to give you GL_BGRA. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Image pixel format conversion
Hi, is the image coming from the GPU? If so, you can let OpenGL convert it for you on the way to CPU if you don't mind too much about transfer speed. Also, double check the image writing code if a certain format does not support BGRA. jp On 01/11/2011 02:40, Blake Mason wrote: I have a osg::image with pixel format of GL_BGRA. I need to convert it to GL_RGB so that I can write out any generic type of image with osgDB (i.e., jpg, png, tiff, etc). Is there an easy way to convert the _data in the image to be in some other format? I could obviously do this myself with a simple loop, but I wanted to see if there was a simple OSG way. writeImageFile is still commented out in the osgscreencapture.cpp example, and I wonder if it's a similar problem. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Image pixel format conversion
Hi Blake, There isn't a convenience method built into osg::Image to do this, but you could easily use gluScaleImage to convert the data. The new inbuilt glu lib within the OSG-3.x has the ability to work without a graphics context, this is enabled by passing in a PixelStorageModes structure in the gluScaleImage call. See the implementation of osg::Image::scaleImage(..) for an example of how this is done. Robert. On Tue, Nov 1, 2011 at 12:40 AM, Blake Mason maso...@llnl.gov wrote: I have a osg::image with pixel format of GL_BGRA. I need to convert it to GL_RGB so that I can write out any generic type of image with osgDB (i.e., jpg, png, tiff, etc). Is there an easy way to convert the _data in the image to be in some other format? I could obviously do this myself with a simple loop, but I wanted to see if there was a simple OSG way. writeImageFile is still commented out in the osgscreencapture.cpp example, and I wonder if it's a similar problem. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Image pixel format conversion
I actually did check the png writing code and it supports BGRA as of OSG 3.0, however I have to support OSG 2.8 also, which does not have that pixel format yet. I did try acquiring the image from the GPU using GL_RGB but could not get it to work, so I stuck with how osgscreencapture did it. -Blake On 2011-10-31 23:58, J.P. Delport wrote: Hi, is the image coming from the GPU? If so, you can let OpenGL convert it for you on the way to CPU if you don't mind too much about transfer speed. Also, double check the image writing code if a certain format does not support BGRA. jp On 01/11/2011 02:40, Blake Mason wrote: I have a osg::image with pixel format of GL_BGRA. I need to convert it to GL_RGB so that I can write out any generic type of image with osgDB (i.e., jpg, png, tiff, etc). Is there an easy way to convert the _data in the image to be in some other format? I could obviously do this myself with a simple loop, but I wanted to see if there was a simple OSG way. writeImageFile is still commented out in the osgscreencapture.cpp example, and I wonder if it's a similar problem. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::Image pixel format conversion
I have a osg::image with pixel format of GL_BGRA. I need to convert it to GL_RGB so that I can write out any generic type of image with osgDB (i.e., jpg, png, tiff, etc). Is there an easy way to convert the _data in the image to be in some other format? I could obviously do this myself with a simple loop, but I wanted to see if there was a simple OSG way. writeImageFile is still commented out in the osgscreencapture.cpp example, and I wonder if it's a similar problem. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org