How to Write to a TIFF File with Oracle JDK

import java.util.Iterator;

import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriter;

public final class TiffSample {

  public static void main(final String[] args) throws Exception {
    final Iterator it = ImageIO.getImageWritersByFormatName("tiff");

    if (it.hasNext()) {
      final ImageWriter writer =;

      final DataOutput out = new FileImageOutputStream(new File("sample.tif"));


      final IIOImage image = ...

      writer.writeInsert(0, image, null); // for the first image



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s