File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Grabbing pixels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Grabbing pixels" Watch "Grabbing pixels" New topic

Grabbing pixels

Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
I�m developing a distributed application with RMI. The client will send an Image�s URL address to server, the server will load this image and grabs its pixels to an array, afterward the server will send the data array to the client, the client will create an image from this data array.
I tried to write piece of code that demonstrate this but it seem I misunderstanding here . I would like to receive a code that allows me to provide this idea .

Shay Gaghe
[ January 16, 2002: Message edited by: Shay Gaghe ]
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Okay... I think I have it doing what you want... three things that I added or changed that helped :
  • Use a MediaTracker to load the Image... this way you can be sure that the Image is fully loaded before you mess with it.
  • Use a MemoryImageSource to build the Image from the pixel array.
  • The second error test in the importPix() method was wrong... I changed it to test the mask in the PixelGrabber's status against the ImageObserver.ABORT code.

  • Here's the code :


    Write once, run anywhere, because there's nowhere to hide! - /. A.C.
    I agree. Here's the link:
    subject: Grabbing pixels
    It's not a secret anymore!