xmlgraphics-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Vacondio (JIRA)" <j...@apache.org>
Subject [jira] [Created] (XGC-106) java.lang.RuntimeException when writing BufferedImage to tiff
Date Wed, 01 Feb 2017 11:20:51 GMT
Andrea Vacondio created XGC-106:
-----------------------------------

             Summary: java.lang.RuntimeException when writing BufferedImage to tiff
                 Key: XGC-106
                 URL: https://issues.apache.org/jira/browse/XGC-106
             Project: XMLGraphicsCommons
          Issue Type: Bug
          Components: image writer
    Affects Versions: 2.0.1
         Environment: Ubuntu 64 bits
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
            Reporter: Andrea Vacondio


Using the latest 2.1 I try to run this snipped to write a BufferedImage as a tif
{code}
public void myTest() throws IOException {
        BufferedImage img = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = img.createGraphics();
        g2d.setBackground(Color.WHITE);
        g2d.fillRect(0, 0, 50, 50);
        g2d.setColor(new Color(20, 23, 54));
        BasicStroke bs = new BasicStroke(2);
        g2d.setStroke(bs);
        g2d.drawLine(0, 0, 25, 25);
        g2d.drawLine(10, 10, 5, 5);
        g2d.dispose();
        TIFFImageWriter writer = new TIFFImageWriter();
        writer.writeImage(img, new ByteArrayOutputStream(), null);
    }
{code}
but I get the following
{code}
java.lang.RuntimeException: Int or float buffers require 32-bit data.
	at org.apache.xmlgraphics.image.codec.tiff.TIFFImageEncoder.validateImage(TIFFImageEncoder.java:983)
	at org.apache.xmlgraphics.image.codec.tiff.TIFFImageEncoder.encode(TIFFImageEncoder.java:198)
	at org.apache.xmlgraphics.image.codec.tiff.TIFFImageEncoder.encode(TIFFImageEncoder.java:112)
	at org.apache.xmlgraphics.image.writer.internal.TIFFImageWriter.writeImage(TIFFImageWriter.java:55)
{code}
The same code works using TwelveMonkeys



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Mime
View raw message