3 Replies Latest reply: May 11, 2010 11:38 PM by 843802 RSS

    draw geotiff in a JFrame

    843802
      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|http://www.mofile.com/pickup/uziiaq7x4zr6fnm/]

      [wu.tif|http://www.mofile.com/pickup/5uvoybjury2fxkn/]

      I hope someone can check it for me ,thanks.