Question

I am trying simple java applet program to display tiff image as below

import java.applet.Applet;
import java.awt.Graphics;

import javax.swing.ImageIcon;


/* <applet code="Form1" width=100 height=50>
</applet> */  
public class Form1 extends Applet
{
     ImageIcon image ;

       public void init(){

           image = new ImageIcon("C:/Documents and Settings/inos002827/Desktop/a.tif");
       }

        public void paint(Graphics g){

              g.drawImage(image.getImage(), 0,0,this);

        }


}

But I am getting blank applet.Same is working for jpeg image.

Was it helpful?

Solution

For TIFF Support, see Java Advanced Imaging.

From the FAQ

What image file formats are supported?

The codec classes supplied with Java Advanced Imaging 1.1.2_01 support BMP, GIF (read only), FlashPix (read only), JPEG, PNG, PNM, TIFF, and WBMP.

OTHER TIPS

From memory, Tiff files are not supported via this means. You will need to look towards the ImageIO API and probably a third party library.

Oddly enough, a 3 second search of google found this Can't read and write a TIFF image file using Java ImageIO standard library

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top