From 67fb0b3530dcb09270b4d344bec2b74ceb24528e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 17 Jul 2015 08:12:38 +0000 Subject: [PATCH] From Patrick Neary, "To the tiff plugin, add the capability to write tiff images with unsigned short data" git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14969 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgPlugins/tiff/ReaderWriterTIFF.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp index a6f7f3fd1..2553c8edd 100644 --- a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp +++ b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp @@ -852,6 +852,9 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter else if (compressTypeOpt == "jpeg") { compressionType = COMPRESSION_JPEG; } + else if (compressTypeOpt == "none") { + compressionType = COMPRESSION_NONE; + } } } } @@ -883,10 +886,12 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter case GL_DEPTH_COMPONENT: case GL_LUMINANCE: case GL_ALPHA: + case GL_RED: photometric = PHOTOMETRIC_MINISBLACK; samplesPerPixel = 1; break; case GL_LUMINANCE_ALPHA: + case GL_RG: photometric = PHOTOMETRIC_MINISBLACK; samplesPerPixel = 2; break; @@ -913,6 +918,10 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT); bitsPerSample = 16; break; + case GL_UNSIGNED_SHORT: + TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT); + bitsPerSample = 16; + break; default: bitsPerSample = 8; break;