r16438 by fschmid - Fixed Bug #9819: "[BUG] Scribus read that image rotated". If more than one orientation exif marker is found, we treat the orientation information as corrupt and return the unrotated thumbnail.

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 9 21:41:46 CET 2011


Author: fschmid
Date: Wed Mar  9 20:41:46 2011
New Revision: 16438

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16438
Log:
Fixed Bug #9819: "[BUG] Scribus read that image rotated". If more than one orientation exif marker is found, we treat the orientation information as corrupt and return the unrotated thumbnail.

Modified:
    trunk/Scribus/scribus/exif.cpp
    trunk/Scribus/scribus/exif.h

Modified: trunk/Scribus/scribus/exif.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16438&path=/trunk/Scribus/scribus/exif.cpp
==============================================================================
--- trunk/Scribus/scribus/exif.cpp (original)
+++ trunk/Scribus/scribus/exif.cpp Wed Mar  9 20:41:46 2011
@@ -529,7 +529,11 @@
 				break;
 
 			case TAG_ORIENTATION:
-				Orientation = ( int ) ConvertAnyFormat ( ValuePtr, Format );
+				if (orientationCount == 0)
+				{
+					Orientation = ( int ) ConvertAnyFormat ( ValuePtr, Format );
+					orientationCount++;
+				}
 				break;
 
 			case TAG_DATETIME_ORIGINAL:
@@ -898,6 +902,7 @@
 	CompressionLevel = 0;
 	exifDataValid = false;
 	recurseLevel = 0;
+	orientationCount = 0;
 }
 
 //--------------------------------------------------------------------------
@@ -963,9 +968,12 @@
 //--------------------------------------------------------------------------
 QImage ExifData::getThumbnail()
 {
-	if ( Thumbnail.isNull() ) return QImage(); // Qt4 NULL->QImage() is it sane?
-	if ( !Orientation || Orientation == 1 ) return Thumbnail;
-
+	if ( Thumbnail.isNull() )
+		return QImage(); // Qt4 NULL->QImage() is it sane?
+	if (orientationCount > 1)
+		return Thumbnail;
+	if ( !Orientation || Orientation == 1 )
+		return Thumbnail;
 	// now fix orientation
 	QTransform M;
 	QTransform flip = QTransform ( -1,0,0,1,0,0 );

Modified: trunk/Scribus/scribus/exif.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16438&path=/trunk/Scribus/scribus/exif.h
==============================================================================
--- trunk/Scribus/scribus/exif.h (original)
+++ trunk/Scribus/scribus/exif.h Wed Mar  9 20:41:46 2011
@@ -57,6 +57,7 @@
 		QString CameraModel;
 		QString DateTime;
 		int   Orientation;
+		int orientationCount;
 		int   Height, Width;
 		int   ExifImageLength, ExifImageWidth;
 		int   IsColor;




More information about the scribus-commit mailing list