Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
venkat - 18 Mar 2007 01:45 GMT
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
Joshua Cranmer - 18 Mar 2007 02:39 GMT
> Hi group ,
>         I used drawImage() function to draw an image on an applet ,
[quoted text clipped - 9 lines]
> Thanks and Regards
> Venkat

*Holds up a sign declaring "javax.imageio"*
Andrew Thompson - 18 Mar 2007 06:29 GMT
..
>         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.
venkat - 18 Mar 2007 06:57 GMT
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
Andrew Thompson - 18 Mar 2007 07:43 GMT
...
> 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.
venkat - 18 Mar 2007 07:59 GMT
> ...
>
[quoted text clipped - 37 lines]
>
> 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.
Joshua Cranmer - 18 Mar 2007 20:16 GMT
>> ...
>>
[quoted text clipped - 41 lines]
>
> 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).
Andrew Thompson - 18 Mar 2007 06:57 GMT
> ..
> >..applet ,..
> > ..Now I want to save this
> > edited image as a .jpg or .gif file.
...
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.