Link to home
Start Free TrialLog in
Avatar of mer
mer

asked on

JPG-Decompression in Java

Hello

I want to send JPG-Pictures with a Socket-Stream to an Applet!! (Byte-Arrays)

But I have no Idea, how I can decode the Picture in Memory.

thanx for help

:-)
      Dennis

Please help
ASKER CERTIFIED SOLUTION
Avatar of fontaine
fontaine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of evijay
evijay

You draw the image on an offscreen canvas which you create on the server side (program which uses ServerSocket), use pixelgrabber class to get the bytes of the image, send the image to applet. In the applet side, use MemoryImageSource to construct back the Image from array of bytes and display the image where ever you want.
You can also read the jpeg image file as byte stream, send it to the applet, applet uses Toolkit.getDefaultToolkit().createImage(byte[] imagedata) method to create the Image back and display

The createImage method understands the byte array format to be either gif or jpeg and handles appropriately