cemplukcute2003
asked on
ImageReader
Hello...
I'm trying to read an image file. The format is in "pgm" files.
Because i try to make some code but it can't work. I surfed the internet and i found an article about ImageReader. I'm trying to put it in my code but it can't be compiled.
The error messages are : can't find symbol class ImageInputStream & Iterator
Can someone help me to fix this problem?
Or does someone can teach me how to read this type of files?
import java.io.*;
import java.net.*;
import java.awt.*;
import javax.imageio.*;
import javax.swing.*;
public class Source_Entropy {
public void Source_Entropy() {
}
public static void main(String[] args) {
File openFilePic;
ImageInputStream buffInputPic;
Iterator cekLoop = ImageIO.getImageReadersByF ormatName( "pgm");
ImageReader readFile = (ImageReader)cekLoop.next( );
try {
openFilePic = new File("lena512.pgm");
buffInputPic = ImageIO.createImageInputSt ream(openF ilePic);
} catch(IOException e) {
e.printStackTrace();
}
}
I'm trying to read an image file. The format is in "pgm" files.
Because i try to make some code but it can't work. I surfed the internet and i found an article about ImageReader. I'm trying to put it in my code but it can't be compiled.
The error messages are : can't find symbol class ImageInputStream & Iterator
Can someone help me to fix this problem?
Or does someone can teach me how to read this type of files?
import java.io.*;
import java.net.*;
import java.awt.*;
import javax.imageio.*;
import javax.swing.*;
public class Source_Entropy {
public void Source_Entropy() {
}
public static void main(String[] args) {
File openFilePic;
ImageInputStream buffInputPic;
Iterator cekLoop = ImageIO.getImageReadersByF
ImageReader readFile = (ImageReader)cekLoop.next(
try {
openFilePic = new File("lena512.pgm");
buffInputPic = ImageIO.createImageInputSt
} catch(IOException e) {
e.printStackTrace();
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
import javax.imageio.stream.*;