1

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.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
happy
  • 2,550
  • 17
  • 64
  • 109

2 Answers2

1

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.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
0

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

Community
  • 1
  • 1
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366