pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1598382 - /pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java
Date Thu, 29 May 2014 19:40:39 GMT
Author: tilman
Date: Thu May 29 19:40:39 2014
New Revision: 1598382

URL: http://svn.apache.org/r1598382
Log:
PDFBOX-2057: revert last 2 changes

Modified:
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java?rev=1598382&r1=1598381&r2=1598382&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java Thu May 29
19:40:39 2014
@@ -20,14 +20,9 @@ import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.io.IOUtils;
 
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPage;
@@ -57,14 +52,6 @@ public class ExtractImages
     private static final String ADDKEY = "-addkey";
     private static final String NONSEQ = "-nonSeq";
 
-    private static final List<String> DCT_FILTERS = new ArrayList<String>();
-
-    static
-    {
-        DCT_FILTERS.add( COSName.DCT_DECODE.getName() );
-        DCT_FILTERS.add( COSName.DCT_DECODE_ABBREVIATION.getName() );
-    }
-
     private ExtractImages()
     {
     }
@@ -229,22 +216,6 @@ public class ExtractImages
         }
         resources.clear();
     }
-    
-    private void writeJpeg2OutputStream(PDImageXObject xobj, OutputStream out)
-            throws IOException
-    {
-        InputStream data = xobj.getPDStream().getPartiallyFilteredStream(DCT_FILTERS);
-        byte[] buf = new byte[1024];
-        int amountRead;
-        while ((amountRead = data.read(buf)) != -1)
-        {
-            out.write(buf, 0, amountRead);
-        }
-        IOUtils.closeQuietly(data);
-        
-        //TODO insert color profile in the output
-        // if one was assigned explicitely inside the PDF file
-    }
 
     /**
      * Writes the image to a file with the filename + an appropriate suffix, like "Image.jpg".
@@ -265,10 +236,6 @@ public class ExtractImages
                 {
                     TIFFInputStream.writeToOutputStream(xobj, out);
                 }
-                else if ("jpg".equals(xobj.getSuffix()))
-                {
-                    writeJpeg2OutputStream(xobj, out);
-                }
                 else
                 {
                     ImageIOUtil.writeImage(image, xobj.getSuffix(), out);



Mime
View raw message