[Q] Saving image  
Author Message
ylee12





PostPosted: 2003-10-21 4:27:00 Top

java-programmer, [Q] Saving image I am looking for a solution to how to make a background image
permanent in a Java application.

My application can have a background image, but when it saves its
file, the background image is not included in the saved file. Is there
a convenient (or right) way to save a gif (or jpeg or png) image into
an application file?

Thanks in advance.

Young-Jin
 
Marco Schmidt





PostPosted: 2003-10-21 4:44:00 Top

java-programmer >> [Q] Saving image Young-Jin Lee:

>I am looking for a solution to how to make a background image
>permanent in a Java application.
>
>My application can have a background image, but when it saves its
>file, the background image is not included in the saved file. Is there
>a convenient (or right) way to save a gif (or jpeg or png) image into
>an application file?

See
<http://www.geocities.com/marcoschmidt.geo/java-image-faq.html#libraries>
and
<http://www.geocities.com/marcoschmidt.geo/java-image-coding.html>.

BTW, an image is an image in Java. It doesn't matter whether it was
loaded from a GIF, JPG or PNG. I'm not totally sure whether you want
to save an existing image (object from a class extending the abstract
java.awt.Image) because you talk about "saving a background image into
a file". Where does the background image come from? Why should it be
saved in a file (how are you saving it right now)?

Regards,
Marco
--
Please reply in the newsgroup, not by email!
Java programming tips: http://jiu.sourceforge.net/javatips.html
Other Java pages: http://www.geocities.com/marcoschmidt.geo/java.html
 
ylee12





PostPosted: 2003-10-31 7:01:00 Top

java-programmer >> [Q] Saving image Marco Schmidt <email***@***.com> wrote in message news:<email***@***.com>...
> Young-Jin Lee:
>
> >I am looking for a solution to how to make a background image
> >permanent in a Java application.
> >
> >My application can have a background image, but when it saves its
> >file, the background image is not included in the saved file. Is there
> >a convenient (or right) way to save a gif (or jpeg or png) image into
> >an application file?
>
> See
> <http://www.geocities.com/marcoschmidt.geo/java-image-faq.html#libraries>
> and
> <http://www.geocities.com/marcoschmidt.geo/java-image-coding.html>.
>
> BTW, an image is an image in Java. It doesn't matter whether it was
> loaded from a GIF, JPG or PNG. I'm not totally sure whether you want
> to save an existing image (object from a class extending the abstract
> java.awt.Image) because you talk about "saving a background image into
> a file". Where does the background image come from? Why should it be
> saved in a file (how are you saving it right now)?
>
> Regards,
> Marco


I should have explained it in more detail. My java application can
read an image (gif or jpeg) and use it as a background image of its
JPanel object. In its JPanel object, users can draw 2D stuffs (line,
rectangle etc.). Currently, it cannot save the image file itself. It
just stores the path of the image file it read. But the problem is
that when a file created with this Java application is given to other
people, the image should be sent separately because the image is not a
part of its file.
What I want to do is to make the image file that this application read
from a hard disk a part of users' 2D drawing stuffs. In other words,
when a user give its 2D drawing created with this application, which
has a background image read from a local hard disk, to other person,
this person should be able to see the 2D drawing with a background
image when he/she opens up this file with this Java application.

Is there an easy way to do this?

Thanks for your help.

Young-Jin