Solved

ImageReader

Posted on 2006-11-09
2
283 Views
Last Modified: 2006-11-18
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.getImageReadersByFormatName("pgm");
            ImageReader readFile = (ImageReader)cekLoop.next();
            
            try {
                  openFilePic = new File("lena512.pgm");
                  buffInputPic = ImageIO.createImageInputStream(openFilePic);
                  
                  
            } catch(IOException e) {
                  e.printStackTrace();
      }
}
0
Comment
Question by:cemplukcute2003
  • 2
2 Comments
 
LVL 9

Accepted Solution

by:
matthew016 earned 125 total points
ID: 17905480
import java.util.Iterator;
0
 
LVL 9

Expert Comment

by:matthew016
ID: 17905489
import javax.imageio.stream.*;
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now