How can I create a JAI PlanarImage from a byte array raster?
I have an application that uses JAI to process i开发者_运维问答mages. It takes TIFF files, reads them, wraps the content into a SeekableStream then uses JAI.create to create the PlanarImage.
What I want to do is change the source from TIFF files to a component, which already exists, and which serves me the image data in the form of a raster stored in a byte array. I know the format of the raster data (width, height, bits per sample etc.).But I can't find a way to create a PlanarImage for JAI in the same way as before.
My only idea is to create a java.awt.Image from the raster and use that with JAI.create. Is this OK, or is there a better solution?
You can use PlanarImage.wrap(bufferedImage) method.
Note: you can create bufferedImage from raster.
Furkan
精彩评论