r15182 by jghali - #9160: Incorrect import of TIFF files

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 12 15:10:19 CEST 2010


Revision: 15182
Author: jghali
Date: 2010-06-12T13:07:12.131973Z
Commit message: #9160: Incorrect import of TIFF files

Changeset: 
M  /trunk/Scribus/scribus/scimgdataloader_tiff.cpp

Diffs:
Index: scribus/scimgdataloader_tiff.cpp
===================================================================
--- scribus/scimgdataloader_tiff.cpp	(revision 15181)
+++ scribus/scimgdataloader_tiff.cpp	(revision 15182)
@@ -286,7 +286,7 @@
 				}
 			}
 			isCMYK = true;
-			m_pixelFormat = Format_CMYK_8;
+			m_pixelFormat = (image->channels() == 5) ? Format_CMYKA_8 : Format_CMYK_8;
 		}
 	}
 	else
@@ -931,13 +931,13 @@
 					{
 						fakeHeader.color_mode = CM_GRAYSCALE;
 						isCMYK = false;
-						chans = 5;
+						chans = 4;
 					}
 					else
 					{
 						fakeHeader.color_mode = CM_RGB;
 						isCMYK = false;
-						chans = 5;
+						chans = 4;
 					}
 					if( !r_image.create( widtht, heightt, chans ))
 						return false;
@@ -1065,11 +1065,20 @@
 			m_imageInfoRecord.yres = qRound(yres*2.54);
 		}
 		if (isCMYK)
+		{
 			m_imageInfoRecord.colorspace = ColorSpaceCMYK;
+			m_pixelFormat = (r_image.channels() == 5) ? Format_CMYKA_8 : Format_CMYK_8;
+		}
 		else if (samplesperpixel == 1)
+		{
+			// Do not set m_pixelFormat here as the real pixel format is most probably different than gray
 			m_imageInfoRecord.colorspace = ColorSpaceGray;
+		}
 		else
+		{
 			m_imageInfoRecord.colorspace = ColorSpaceRGB;
+			m_pixelFormat = Format_RGBA_8;
+		}
 		m_imageInfoRecord.BBoxX = 0;
 		m_imageInfoRecord.BBoxH = r_image.height();
 		if ((m_imageInfoRecord.layerInfo.isEmpty()) && (m_imageInfoRecord.PDSpathData.isEmpty()))




More information about the scribus-commit mailing list