Display TIFF image in all web browser

How to handle TIFF file in HTML pages?

I want to display a TIFF file in my HTML page.

I have tried using embedded tag, object id, img, etc. But I am unable to display the image (TIFF) in the HTML page.

I am not using Java, .NET or any other thing in my project. I am using HTML only.

Hi all,

To the above question, yesterday I got solution. i.e safari able to support TIFF image loading.

What should i do to load TIFF image in the remaining unsupported browser(IE, Mozilla, Firefox, etc)

I am unable to install third party installer or controller(like ActiveXController).

Please give your valuable suggestion to this.

Thanks in Advance.


This comes down to browser image support; it looks like the only mainstream browser that supports tiff is Safari:


Where are you getting the tiff images from? Is it possible for them to be generated in a different format?

If you have a static set of images then I'd recommend using something like PaintShop Pro to batch convert them, changing the format.

If this isn't an option then there might be some mileage in looking for a pre-written Java applet (or another browser plugin) that can display the images in the browser.

I found this resource that details the various methods: How to embed TIFF files in HTML documents

As mentioned, it will very much depend on browser support for the format. Viewing that page in Chrome on Windows didn't display any of the images.

It would also be helpful if you posted the code you've tried already.

Tiff images can be displayed directly onto IE and safari only.. no support of tiff images on chrome and firefox. you can encode the image and then display it on browser by decoding the encoded image to some other format. Hope this works for you

I can show tiff image in all browser. The ie browser by default show tiff images but firefox and chrome and other browser you should convert the tiff image from img html tag to canvas tag. bottom links do this convert. please view bottom links demos: https://github.com/rasouliali/TiffViewer

You can try converting your image from tiff to PNG, here is how to do it:

import com.sun.media.jai.codec.ImageCodec;
import com.sun.media.jai.codec.ImageDecoder;
import com.sun.media.jai.codec.ImageEncoder;
import com.sun.media.jai.codec.PNGEncodeParam;
import com.sun.media.jai.codec.TIFFDecodeParam;
import java.awt.image.RenderedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import javaxt.io.Image;

public class ImgConvTiffToPng {

    public static byte[] convert(byte[] tiff) throws Exception {

        byte[] out = new byte[0];
        InputStream inputStream = new ByteArrayInputStream(tiff);

        TIFFDecodeParam param = null;

        ImageDecoder dec = ImageCodec.createImageDecoder("tiff", inputStream, param);
        RenderedImage op = dec.decodeAsRenderedImage(0);

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        PNGEncodeParam jpgparam = null;
        ImageEncoder en = ImageCodec.createImageEncoder("png", outputStream, jpgparam);
        outputStream = (ByteArrayOutputStream) en.getOutputStream();
        out = outputStream.toByteArray();

        return out;


Need Your Help

load scripts asynchronously

javascript html ajax html5 asynchronous

I am using several plugins, custom widgets and some other libraries from JQuery. as a result I have several .js and .css files. I need to create a loader for my site because it takes some time to l...