Re: ByteArraySeekableStream ignores offset

From: ak (spam_at_imagero.com)
Date: 02/06/04


Date: Fri, 6 Feb 2004 19:19:45 +0100


> ByteArraySeekableStream stream = new ByteArraySeekableStream(data, 78,
> data.length - 78);
> PlanarImage source = JAI.create("stream", stream);
> WritableRaster raster = source.copyData(); <== exception thrown here
> ColorModel cm = source.getColorModel();
> BufferedImage image = new BufferedImage(cm, raster, false, (Hashtable)
> null);

what I can't understand is why you first create PlanarImage and after
convert it to BufferedImage.
Use ImageIO and read direct as BufferedImage.

____________

http://reader.imagero.com the best java image reader.



Relevant Pages

  • Re: show 16bit greyscale BufferedImage on screen
    ... found a way by using DisplayJAI instead of a panel. ... then you should use PlanarImage, instead of BufferedImage ... http://reader.imagero.com the best java image reader. ...
    (comp.lang.java.gui)
  • Re: ByteArraySeekableStream ignores offset
    ... > Use ImageIO and read direct as BufferedImage. ... E.g. for BMP images the BufferedImage returned from ImageIO is null. ... PlanarImage etc. is how JAI creates images. ...
    (comp.lang.java.gui)
  • Re: JAI - Reduce memory requirements for TIF --> JPEG translation
    ... BTW if you use JAI only to save image, you may better use ImageIO - ... in this case you don't need even PlanarImage and can save BufferedImage ... http://uio.imagero.com Unified I/O for Java ...
    (comp.lang.java.programmer)
  • Re: JAI - Reduce memory requirements for TIF --> JPEG translation
    ... >>anyway you don't need WritableRaster and second BufferedImage. ... http://uio.imagero.com Unified I/O for Java ... http://reader.imagero.com Java image reader ...
    (comp.lang.java.programmer)
  • Re: Split an image in two parts
    ... > I need to split a bufferedimage in two parts to draw them after in a ... getSubimage is the better solution because new BufferedImage shares the same ... http://uio.dev.java.net Unified I/O for Java ... http://reader.imagero.com Java image reader ...
    (comp.lang.java.programmer)