commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1297330 - /commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java
Date Tue, 06 Mar 2012 02:59:07 GMT
Author: damjan
Date: Tue Mar  6 02:59:06 2012
New Revision: 1297330

URL: http://svn.apache.org/viewvc?rev=1297330&view=rev
Log:
TIFF RowsPerStrip can be absent, and means infinity.

Submittted by: Piyush Kapoor <pkapoor at adobe dot com>
Jira issue key: SANSELAN-65


Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java?rev=1297330&r1=1297329&r2=1297330&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java
Tue Mar  6 02:59:06 2012
@@ -478,9 +478,18 @@ public class TiffReader extends BinaryFi
         {
             TiffField rowsPerStripField = directory
                     .findField(TiffTagConstants.TIFF_TAG_ROWS_PER_STRIP);
-            if (null == rowsPerStripField)
-                throw new ImageReadException("Can't find rows per strip field.");
-            int rowsPerStrip = rowsPerStripField.getIntValue();
+            int rowsPerStrip ; 
+
+            if (null != rowsPerStripField) {
+                rowsPerStrip = rowsPerStripField.getIntValue();
+            } else {
+                TiffField imageHeight = directory.findField(TiffTagConstants.TIFF_TAG_IMAGE_LENGTH);
+                /**
+                 * if rows per strip not present then rowsPerStrip 
+                 * is equal to imageLength or an infinity value;
+                 */
+                rowsPerStrip = imageHeight.getIntValue();           
+            }
 
             return new TiffImageData.Strips(data, rowsPerStrip);
         } else



Mime
View raw message