From cf268b4cfd47a49f36926a2779258c660fb85340 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 17 Jul 2015 08:13:01 +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/branches/OpenSceneGraph-3.2@14971 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 946fbabfa..115be26c9 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;