atom feed8 messages in net.java.dev.jai-imageio.interestRe: [JAI-IMAGEIO] Re: javax.imageio.I...
FromSent OnAttachments
jai-...@javadesktop.orgFeb 28, 2008 2:00 am 
robert engelsFeb 28, 2008 7:14 am 
robert engelsFeb 28, 2008 7:15 am 
jai-...@javadesktop.orgFeb 28, 2008 1:42 pm 
robert engelsFeb 28, 2008 2:17 pm 
Brian BurkhalterFeb 28, 2008 2:26 pm 
jai-...@javadesktop.orgFeb 29, 2008 2:22 am 
jai-...@javadesktop.orgFeb 29, 2008 1:33 pm 
Subject:Re: [JAI-IMAGEIO] Re: javax.imageio.IIOException: Destination type from Ima
From:robert engels (reng@ix.netcom.com)
Date:Feb 28, 2008 7:15:37 am
List:net.java.dev.jai-imageio.interest

Hit send, while editing... the line should be INT_RGB, not INT_RGBA

I also tried with INT_ARGB images and I still got a 'custom' image.

It seems the PNG reader is not doing what it should.

I used the following testcase to show that the PNG reader is reading the image as a 'Custom' image type when the source was INT_RGB.

A bug should be filed.

import java.awt.image.BufferedImage; import java.io.File;

import javax.imageio.ImageIO;

public class ImageWriteReadTest { public static void main(String[] args) throws Exception { BufferedImage img = new BufferedImage (800,600,BufferedImage.TYPE_INT_RGBA); File f = new File("test.ong"); ImageIO.write(img,"png",f); BufferedImage img0 = ImageIO.read(f); System.out.println("image are the same = "+(img.getType() ==img0.getType())+": orig = "+img.getType()+", new ="+img0.getType()); } }

On Feb 28, 2008, at 4:00 AM, jai-@javadesktop.org wrote:

I don't need to write the png to disk -- I can just read the size direct from the buffer. Here's why:

The big picture is 1. (Server) Create a BufferedImage, size 256x256 2. (Server) Instantiate a Graphics from the image and draw into it 3. (Server) Serialise the BufferedImage (using ImageIO) to send the data to a client 4. (Client) Un-serialise the data (using ImageIO) back into a BufferedImage 5. (Client) Apply local changes to the BufferedImage 6. (Client) Blit BufferedImage onto user's screen

I've tried to describe steps 3+4. Obviously, I want this to be lossless. The streams I'm providing to the ImageIO are backed by a ByteBuffer (which is trivially serialisable). I'm finding the data copied out of the buffer is between 5KB and 30KB, which seems reasonable.

If BufferedImage implemented Serialisable, I would (probably) just use that. My alternative is to hand-serialise BufferedImage, but I'm not very happy doing that.

The problem appears at step 4, where the reconstructed BufferedImage is 4 times the size it needs to be and my attempts to coerce ImageIO into doing The Right Thing meet only exceptions.

Neil. [Message sent by forum member 'nrg' (nrg)]

http://forums.java.net/jive/thread.jspa?messageID=261358