import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriter;
import com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriterSpi;
public class Tiff {
public static void createMultiImage(BufferedImage[] images, File dest) throws IOException {
ImageIO.scanForPlugins();
ImageWriter iw = new TIFFImageWriterSpi().createWriterInstance();
if (iw != null && iw.canWriteSequence()) {
iw.setOutput(ImageIO.createImageOutputStream(dest));
iw.prepareWriteSequence(null);
for (BufferedImage img : images) {
iw.writeToSequence(new IIOImage(img, null, null), null);
}
iw.endWriteSequence();
}
}
}
required package :
https://jai-imageio.dev.java.net/