• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Bitmap from Canvas and converting it into image file format

 
Nilesh Soni
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am drawing some lines or any shapes in an applet. now i want to save that drawing or applet into an image like gif or jpeg. one funda is that we will click on one button on applet, it will contact a setvlet on the server and on the server i have to write some code.
I got reply from one of the javaranch member Tim Holloway as follows:
You'll need to convert the applet's canvas into a bitmap, convert the bitmap into JPEG or GIF format, then send the bitmap in a binary file transmission to the server. The server really can't do anything but catch the file - all the work has to be done on the client.
Can any one help me out in this regards.
------------------
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone posted this code a while back... it draws some text on a canvas and saves it as a JPEG image... it helped me understand what to do to generate an image file from an image...



It saves it as a JPEG because a JPEG encoder is shipped with the JDK by Sun... to save as a GIF file you'll either need to look at the Java Media Framework, or go with a 3rd party implementation...

-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic