Solved

ImageReader

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 54
java jdbc batch example 8 41
runtime exception 2 42
Coding for the first time 9 37
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

820 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