r14866 by fschmid - Fixed Bug #8763: "Take image orientation from Exif information into account"

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 10 15:00:18 CET 2010


Revision: 14866
Author: fschmid
Date: 2010-03-10T13:53:33.188087Z
Commit message: Fixed Bug #8763: "Take image orientation from Exif information into account"

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

Diffs:
Index: scribus/scimgdataloader_jpeg.cpp
===================================================================
--- scribus/scimgdataloader_jpeg.cpp	(revision 14865)
+++ scribus/scimgdataloader_jpeg.cpp	(revision 14866)
@@ -473,6 +473,47 @@
 	(void) jpeg_finish_decompress(&cinfo);
 	fclose (infile);
 	jpeg_destroy_decompress (&cinfo);
+	if ((exi) && (ExifInf.exifDataValid))
+	{
+		int ori = ExifInf.getOrientation();
+		int oxres, oyres;
+		if (ori != 1)
+		{
+			QTransform M;
+			QTransform flip = QTransform ( -1,0,0,1,0,0 );
+			switch ( ori )
+			{  // notice intentional fallthroughs
+				case 2:
+					M = flip;
+					break;
+				case 4:
+					M = flip;
+				case 3:
+					M.rotate (180);
+					break;
+				case 5:
+					M = flip;
+				case 6:
+					M.rotate(90);
+					oxres = m_imageInfoRecord.xres;
+					oyres = m_imageInfoRecord.yres;
+					m_imageInfoRecord.xres = oyres;
+					m_imageInfoRecord.yres = oxres;
+					break;
+				case 7:
+					M = flip;
+				case 8:
+					M.rotate(270);
+					oxres = m_imageInfoRecord.xres;
+					oyres = m_imageInfoRecord.yres;
+					m_imageInfoRecord.xres = oyres;
+					m_imageInfoRecord.yres = oxres;
+					break;
+				default: break; // should never happen
+			}
+			m_image = m_image.transformed(M);
+		}
+	}
 	m_imageInfoRecord.layerInfo.clear();
 	m_imageInfoRecord.BBoxX = 0;
 	m_imageInfoRecord.BBoxH = m_image.height();




More information about the scribus-commit mailing list