Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1734

ImageIoUtil.WriteImage doesn't work with tiff images

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8.5, 2.0.0
    • Component/s: Rendering
    • Labels:
    • Environment:
      XP, W7

      Description

      ImageIoUtil.WriteImage brings an I/O error exception when trying to write a tiff file. Debugging shows that the cause is "Bits per sample must be 1 for RLE compression!". This means that the compression used (the first one of the following list, returned by writerParams.getCompressionTypes() ) is only allowed for bitonal images.
      CCITT RLE
      CCITT T.4
      CCITT T.6
      LZW
      JPEG
      ZLib
      PackBits
      Deflate
      EXIF JPEG

      After correcting this, the next problem was that tiff images didn't have the proper resolutions. I added that too. Yes it uses the com.sun.* classes; however there is no other way. Even apache xmlgraphics uses them, although in a very different way than I do
      https://svn.apache.org/repos/asf/xmlgraphics/commons/tags/commons-1_3_1/src/java/org/apache/xmlgraphics/image/writer/imageio/ImageIOTIFFImageWriter.java

      writeImage() has a parameter "int imageType" which is never used. Why?

        Attachments

        1. ImageIOUtil.patch
          14 kB
          Tilman Hausherr
        2. ImageIOUtil.patch
          5 kB
          Tilman Hausherr
        3. TestImageIOUtils.patch
          0.9 kB
          Tilman Hausherr

          Issue Links

            Activity

              People

              • Assignee:
                tilman Tilman Hausherr
                Reporter:
                tilman Tilman Hausherr
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: