[Q] Saving image

Y

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?

Thanks in advance.

Young-Jin
 
M

Marco Schmidt

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
 
Y

Young-Jin Lee

Marco Schmidt said:
Young-Jin Lee:


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
 

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

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top