Popular Posts
Asynchronous and deferred JavaScript execution explained Normal execution <script> This is the default behavior of the <script> element. Parsing of the HTML code pauses while the scr... JSON Foramter <html> <head>     <title>JSON Formater</title>     <style type="text/css">     body{         margin:... Wrong text encoding while Jsoup parse document While page encoding is different with content type encoding declaration. Jsoup will get wrong text decode content. To avoid this problem, As...
Stats
Create multi tiff image
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/