Hi Matt,

The tiff reader supports 16 bit, but the writer may not be support all
possible formats.  Feel free to add what is missing.

Robert.

On 8/23/07, Gregory, Matthew <[EMAIL PROTECTED]> wrote:
> Forgive what is likely a newbie question.
>
> I'm trying to write out an unsigned 16-bit tif image using
> osgDB::writeImageFile.  Here is a very simple program to write out a 100
> x 100 image ...
>
> ==============================================================
>
> #include <osg/Image>
> #include <osgDB/WriteFile>
> #include <string>
>
> int main()
> {
>    int n = 100;
>    osg::Image* resultImage = new osg::Image;
>
>    resultImage->
>       allocateImage(n, n, 1, GL_LUMINANCE, GL_UNSIGNED_SHORT);
>
>    unsigned short* ptr = (unsigned short*) resultImage->data();
>
>    for (int i=0; i<n; i++)
>    {
>       for (int j=0; j<n; j++)
>       {
>          *(ptr++) = 1500 + j;
>       }
>    }
>
>    osgDB::writeImageFile(*resultImage, "foo.tif");
> }
>
> ==============================================================
>
> The resulting image is treated as an 8-bit image with each pixel as a
> byte in the unsigned short.  From stepping through the readerwriter.cpp
> code, it looks like this is the intended behavior.
>
> Two questions:
>
> 1) Does this code account for images other than 8-bit?
> 2) Is there another way I should be calling this?
>
> Thanks for any help, matt
>
> Matt Gregory
> Faculty Research Assistant
> Department of Forest Science
> Oregon State University
> Phone : (541) 758-7778
> Email : [EMAIL PROTECTED]
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to