This content has been marked as final. Show 2 replies
To create a multipage tiff you use the method TIFFEncodeParam#setExtraImages. The method takes an iterator. I'm not sure if there is a built in way to append pages to an already existing file, but in theory you can read from the already existing file as needed (when iterator#next is called) and write to a temporary file, before replacing the existing file with the temporary one. So you'll still have to read the existing file, but you don't have to keep all the images in memory.
If you switch to core java's ImageWriter/ImageReader api and get [JAI-Imageio|https://jai-imageio.dev.java.net/binary-builds.html] (which has a TIFF ImageWriter plugin) then you can insert images into an already existing file. Presumably the TIFF ImageWriter appends directly to the file.
The only thing special about a BufferedImage is that it has exactly one raster at (0,0) and it's guaranteed to have a color model. RenderedImages may have more than one raster and are not guaranteed to have a color model. But if your RenderedImage does have a color model, then you get rgb data from it the same way a BufferedImage does,
There are other ways, but this is the most generic.
colorModel.getRGB(raster.getDataElements(x, y, null));
i can't tell you how to create multipage tiff by using the software you are talking about. but i do know how to make to make the tiff out by using other software. if you are interested in , please let me know.