commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1220618 - in /commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff: TiffImageParser.java TiffReader.java
Date Mon, 19 Dec 2011 06:02:03 GMT
Author: damjan
Date: Mon Dec 19 06:02:03 2011
New Revision: 1220618

URL: http://svn.apache.org/viewvc?rev=1220618&view=rev
Log:
Support reading multiple images from TIFF files.


Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
    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/TiffImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java?rev=1220618&r1=1220617&r2=1220618&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
Mon Dec 19 06:02:03 2011
@@ -444,6 +444,24 @@ public class TiffImageParser extends Ima
         return result;
     }
 
+    public ArrayList getAllBufferedImages(ByteSource byteSource)
+            throws ImageReadException, IOException
+    {
+        FormatCompliance formatCompliance = FormatCompliance.getDefault();
+        TiffContents contents = new TiffReader(true).readDirectories(byteSource, true, formatCompliance);
+        ArrayList results = new ArrayList();
+        for (int i = 0; i < contents.directories.size(); i++)
+        {
+            TiffDirectory directory = (TiffDirectory) contents.directories.get(i);
+            BufferedImage result = directory.getTiffImage(null);
+            if (result != null)
+            {
+                results.add(result);
+            }
+        }
+        return results;
+    } 
+
     protected BufferedImage getBufferedImage(TiffDirectory directory, Map params)
             throws ImageReadException, IOException
     {

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=1220618&r1=1220617&r2=1220618&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
Mon Dec 19 06:02:03 2011
@@ -432,7 +432,7 @@ public class TiffReader extends BinaryFi
             boolean readImageData, FormatCompliance formatCompliance)
             throws ImageReadException, IOException
     {
-        Collector collector = new FirstDirectoryCollector(readImageData);
+        Collector collector = new Collector(null);
         readDirectories(byteSource, formatCompliance, collector);
         TiffContents contents = collector.getContents();
         if (contents.directories.size() < 1)



Mime
View raw message