tags:

views:

18

answers:

0

Hi: However I found that some geotiff image can be displayed in a JFrame,however others can not.

The core codes:

  PlanarImage resultImage = null;

  InputStream is = null;
  try {
   is = new FileInputStream(new File("D:/wu.tif"));
  } catch (FileNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  SeekableStream seekableStream = SeekableStream.wrapInputStream(is, true);
  ParameterBlock pb = new ParameterBlock();
  pb.add(seekableStream);

  resultImage = JAI.create("TIFF", pb);

  JFrame jf=new JFrame("Geo");
  jf.setSize(800,600);
  jf.setVisible(true);

  Graphics g=jf.getGraphics();
  g.drawImage(resultImage.getAsBufferedImage(), 0, 0, null);

The two geotiff, usa.tiff and wu.tif, the wu.tif can not drawed in the JFrame, it is a black blank.

I wonder why?

The files can be found there :

usa.tiff

wu.tif

I hope someone can check it for me ,thanks.