简体   繁体   中英

How can I create a JAI PlanarImage from a byte array raster?

I have an application that uses JAI to process images. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM