Solved

ImageReader

Posted on 2006-11-09
2
281 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bunnyEars2 challenge 6 68
java set up 1 46
maven example error 3 35
Cipher Configuration on Apache HTTPD 4 20
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
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 will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

705 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

15 Experts available now in Live!

Get 1:1 Help Now