Bem to fazendo um trabalho e estou tendo problemas com imagens do tipo PGM onde eu preciso abrir elas exibi-las e fazer operações com ela, porém estou com muita dificuldade em exibir elas em um Frame, consigo abrir imagens com outras extensões porém consegui nada com PGM, o código segue o seguinte
public class ShowImage extends JFrame{
public ShowImage(File file) throws IOException{
try{
BufferedImage image = ImageIO.read(file);
System.err.println("Aqui");
String Imageinf = "Dimensoes:"+image.getWidth()+"x"+image.getHeight()+"Bandas:"+image.getRaster().getNumBands();
ImageIcon icone = new ImageIcon(image);
JLabel labImage = new JLabel(icone);
this.setSize(image.getWidth(), image.getHeight());
this.add(labImage);
this.setVisible(true);
}catch(IOException e){
System.err.println("Erro ao tentar converter ou alguma coisa");
}
}
}