how to save an edited image ( painted on an applet) as .jpg or .gif

V

venkat

Hi group ,
I used drawImage() function to draw an image on an applet ,
you can paint on this image in the applet. Now I want to save this
edited image as a .jpg or .gif file. I would like some one to help me
put in this.

The whole thing should look almost like the online image editor which
is shown in the following link.

http://www.izhuk.com/painter/medicine/


Thanks and Regards
Venkat
 
J

Joshua Cranmer

venkat said:
Hi group ,
I used drawImage() function to draw an image on an applet ,
you can paint on this image in the applet. Now I want to save this
edited image as a .jpg or .gif file. I would like some one to help me
put in this.

The whole thing should look almost like the online image editor which
is shown in the following link.

http://www.izhuk.com/painter/medicine/


Thanks and Regards
Venkat

*Holds up a sign declaring "javax.imageio"*
 
A

Andrew Thompson

I used drawImage() function to draw an image on an applet ,
you can paint on this image in the applet. Now I want to save this
edited image as a .jpg or .gif file. I would like some one to help me
put in this.

It would help if you asked a specific question.
Note that to save to the local file system, an
applet will either need to be signed and trusted,
or launched using web start, for use of the JNLP
API file access abilities.

Andrew T.
 
V

venkat

I am sorry, I was not specific about my problem .

I wanted to simulate the online image editor which looks and functions
exactly similar to the image editor that is shown in the link below
by using java applets.

http://www.izhuk.com/painter/medicine/


I was able to put the image on an applet and was able to draw on it.
Now I want to save this edited image into a .jpg or .gif file, which
could be sent to the server and be saved in a sql table.

I would be thankful if any one could help me in this matter .


Regards
Venkat
 
A

Andrew Thompson

....
Note that to save to the local file system, an
applet will either need to be signed and trusted,
or launched using web start, for use of the JNLP
API file access abilities.

Now that I have tried that image editor, I
realise they have done something quite tricky
(but very inefficient), in order to avoid
having to ask the user to accept signed code.

To deliver the final image to the user, the
applet transmits the altered image back to
the server, the server prepares a standard
Gif (PNG, whatever..) and delivers that back
to the client as a standard image with the
message 'right click to save..' (I wonder how
that works for mice with only one button?).

In any case, to do it 'just like they have'
requires an active server (to process and
redirect the images back to the client).

I recommend web start as an alternative,
since that will allow the images to be
saved directly by the client, without
having to go for a round trip to the server
and back (though in the 'unsigned' form that
I recommend deploying, Java will prompt the
user if they want to allow file access on
image save). Here is an example of the JNLP
file API usage in an unsigned application.
<http://www.physci.org/jws/#fs>

HTH

Andrew T.
 
A

Andrew Thompson

I wanted to simulate the online image editor which looks and functions
exactly similar to the image editor that is shown in the link below
by using java applets.

'Exactly similar' is a confusing term. It
is almost that same words as 'exactly the same'
but has quite different meaning. 'Exactly the same'
means 'exactly the same' - no differences whatsoever,
whereas 'exactly similar' is a clash of words,
since similar means 'almost, but *not* exactly,
the same'.

The reason I point this out is because..
http://www.izhuk.com/painter/medicine/

I was able to put the image on an applet and was able to draw on it.
Now I want to save this edited image into a .jpg or .gif file, which
could be sent to the server and be saved in a sql table.

There is no evidence on hand that suggests
the deployers of that applet store the images
in 'a sql table'. Further, storing an image
back to the server (without offering the image
for download) can be simpler than saving it
to the user's disk, and it can all be done within
the one web page, and would not require any 'trust'
on the part of the client.

So, to be specific about the user side of it.
Are you *also* intending to offer the image
for the end user to save? Or is it only for
storage in the server?

(I took the liberty of changing the subject line,
to more closely reflect the task as I currently
understand it.)

Andrew T.
 
V

venkat

'Exactly similar' is a confusing term. It
is almost that same words as 'exactly the same'
but has quite different meaning. 'Exactly the same'
means 'exactly the same' - no differences whatsoever,
whereas 'exactly similar' is a clash of words,
since similar means 'almost, but *not* exactly,
the same'.

The reason I point this out is because..



There is no evidence on hand that suggests
the deployers of that applet store the images
in 'a sql table'. Further, storing an image
back to the server (without offering the image
for download) can be simpler than saving it
to the user's disk, and it can all be done within
the one web page, and would not require any 'trust'
on the part of the client.

So, to be specific about the user side of it.
Are you *also* intending to offer the image
for the end user to save? Or is it only for
storage in the server?

(I took the liberty of changing the subject line,
to more closely reflect the task as I currently
understand it.)

Andrew T.

No , my task is to save the edited image on to server... and there is
no need(in particular) to save the image on the client.
I want to save the image into a sql table at the server end so that it
could be pulled up as when required.

Thank you Mr . Andrew for your quick responses.
 
J

Joshua Cranmer

venkat said:
No , my task is to save the edited image on to server... and there is
no need(in particular) to save the image on the client.
I want to save the image into a sql table at the server end so that it
could be pulled up as when required.

Thank you Mr . Andrew for your quick responses.

If you take a look at the javax.imageio API's, the information to write
and save images is included in there. In Java 1.4, RW capabilities are
provided for JPEG, PNG, and R for GIF, 1.5 added RW capabilities for BMP
and WBMP, while 6 provided W capabilities for GIF (due to LZW patent
complications).

Poke around javax.imageio.ImageIO especially for more details -- you can
print to an arbitrary OutputStream given a format name and a
RenderedImage (e.g. BufferedImage).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top