Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-436

TIFF 1bpp image with svgbrowser not drawable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Resolution: Unresolved
    • 1.5
    • None
    • SVG Viewer
    • None
    • Operating System: All
      Platform: PC

    Description

      If a SVG file contains an image tag which references a TIFF
      1 bpp CCITT T.6 like

      <?xml version="1.0" standalone="no"?>
      <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
      "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

      <svg xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink" width="450" height="800" viewBox="0
      0 450 800">

      <image xlink:href="tests/resources/images/a4.tif"
      x="0" y="0" width="100%" height="100%" />

      </svg>

      the error

      java.lang.ArrayIndexOutOfBoundsException: 1728
      at java.awt.image.SinglePixelPackedSampleModel.setPixels
      (SinglePixelPackedSampleModel.java:670)
      at java.awt.image.WritableRaster.setPixels(WritableRaster.java:547)
      at sun.awt.image.SunWritableRaster.setPixels(SunWritableRaster.java:132)
      at org.apache.batik.ext.awt.image.GraphicsUtil.copyData_FALLBACK
      (GraphicsUtil.java:791)
      at org.apache.batik.ext.awt.image.GraphicsUtil.copyData
      (GraphicsUtil.java:810)
      at org.apache.batik.ext.awt.image.rendered.Any2sRGBRed.copyData
      (Any2sRGBRed.java:209)
      at org.apache.batik.ext.awt.image.rendered.AbstractRed.getData
      (AbstractRed.java:513)
      ...

      occurs with org.apache.batik.apps.svgbrowser.Main.
      This is done because the source has 1 band, the destination 3;
      An ColorConvertOp is not done because the ColorSpaces are
      compared; but the TIFFImage has the same ColorSpace as the Destination.
      Following change helpes me:

      • @version $Id: Any2sRGBRed.java,v 1.5 2003/04/11 13:57:59 vhardy Exp $ */

      199,200c199
      < if (srcCM.getColorSpace() == dstCM.getColorSpace()
      < && srcCM.isCompatibleRaster(wr)) {

      > if (srcCM.getColorSpace() == dstCM.getColorSpace()) {

      Attachments

        1. Batik-Bug25142-TestCase.svg
          0.3 kB
          Helder Magalhães

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            klaus.bartz@coi.de Klaus Bartz
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: