URGENT:Changing Pixels within an image at run-time

Posted on 2003-12-06
Last Modified: 2010-03-31
In my code, I am using an image of size 200*200. At run-time, I am calculating new values for a pixel, and need to change a few of the pixels. So, on my display, I only want to change the values of the changed pixels instead of drawing the entire image again. How can I do it in Java. What are the data types will i have to use?

This is an extremely urgent question. I need an answer as soon as possible.

Question by:miteshn
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 86

Expert Comment

ID: 9888548
You can use a PixelGrabber to get the pixels:
LVL 86

Expert Comment

ID: 9888553
You can also work with an ImageFilter:

Author Comment

ID: 9889986
If I have my Image on a form, how do I reflect the changes on the image? I do not want to redraw the entire form. using Pixel grabber or ImageFilter, I can change the array values, but how do i reflect these changes on screen?

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 92

Accepted Solution

objects earned 250 total points
ID: 9890180
Use a BufferedImage, it allows you to change individual pixel values.
Then call repaint() on the component displaying the image to show changes on screen.
LVL 92

Expert Comment

ID: 9890488
eg. if the image was painted at the origin of your component and you wanted to change the pixel at 10, 10:

mybufferedimage.setRGB(10, 10, rgb);
repaint(10, 10, 1, 1);

LVL 86

Assisted Solution

CEHJ earned 250 total points
ID: 9891866
If you want to use a BufferedImage, the easiest way to get one is:

BufferedImage image = File("x.jpg"));
LVL 86

Expert Comment

ID: 9892090
LVL 92

Expert Comment

ID: 9892999

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
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.
Suggested Courses

752 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