473,416 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

how to get the pixel of tha image

I want get the pixel value for image of jpg format here is my code to display the image

Expand|Select|Wrap|Line Numbers
  1. import java.awt.*;
  2. import java.awt.image.BufferedImage;
  3. import java.io.*;
  4. import javax.imageio.ImageIO;
  5. import javax.swing.JFrame;
  6. public class ShowImage extends Panel {
  7.     BufferedImage  image;
  8.   public ShowImage() {
  9.     try {
  10.     System.out.println("Enter image name\n");
  11.     BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
  12.      String imageName=bf.readLine();
  13.     File input = new File(imageName);
  14.         image = ImageIO.read(input);
  15.     } catch (IOException ie) {
  16.       System.out.println("Error:"+ie.getMessage());
  17.     }
  18.   }
  19.  
  20.   public void paint(Graphics g) {
  21.     g.drawImage( image, 100,100, null);
  22.   }
  23.  
  24.   static public void main(String args[]) throws Exception {
  25.     JFrame frame = new JFrame("zinab");
  26.     Panel panel = new ShowImage();
  27.     frame.getContentPane().add(panel);
  28.     frame.setSize(500, 500);
  29.     frame.setVisible(true);
  30.   }
  31. }
May 22 '10 #1
1 1569
jkmyoung
2,057 Expert 2GB
MODS: Please delete this thread as it is a duplicate of http://bytes.com/topic/java/answers/...eady-displayed
May 25 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Deepa | last post by:
Hi All, I'm facing problem displaying image of size 5000X5000 .My window size is smaller than image size so i'm not able to see the complete image.i can use scroll bars to view the image but i...
14
by: George Hester | last post by:
http://hesterloli.dnsalias.com/test/javascript_image.htm The image is the 100x100 px block. If we right-click in it and try to save the image we cannot. Is it possible to say set a mime-type so...
2
by: querypk | last post by:
Can some one help me to read PGM/PPM Images in C/C++. I am sure there should be a library or a simple routine to read the pixels of an Image and return a 2D array of pixel values...
4
by: malcolm | last post by:
I've seen several posts around the Internet and many of them either don't work or only partially work. All I'm trying to do is record some action asynchronously from an html file, a sort of logging...
2
by: Alan Silver | last post by:
Hello, If I have the following HTML... <input type="image" src="fred.gif"> .... is there a way to specify the image in CSS rather than in the HTML? TIA
2
by: Ira | last post by:
Is it possible to convert a 32-bit color image into a 1-bit-per-pixel image in VB.net? If yes, how can it be done?
4
by: NASAdude | last post by:
I'm working on distributing a database using VS Tools for Office, and am having trouble with linked images on forms/reports. The image objects have a default path\file set on the .Picture property,...
4
by: Tim Streater | last post by:
I have a small image on my web page that, when clicked, does some javascript stuff which changes the page. To highlight that this has happened, I want to replace the image with another. Each is a...
2
by: Noorain | last post by:
Hi, another problem. i upload width=800 pixels image in database through. this image resize by thumb image & bis image. thumb image width is 100 pixel & big image width is 400 pixel. 800 pixel image...
2
archonmagnus
by: archonmagnus | last post by:
Hello all, I've been experimenting with developing an orbital analysis program. Being a visually oriented person, I'd like to translate my (x, y) coordinate pairs to an pixel image array so I can...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.