How to open a file containing a gif image from a Java application?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sridhar_narasimhan
Posted On:   Friday, April 20, 2001 11:24 PM

I am trying to read a file containing a gif image from my application.
To read the contents of the file and also write or update.
Can any one help me on this?

Re: How to open a file containing a gif image from a Java application?

Posted By:   Tim_Rohaly  
Posted On:   Saturday, April 21, 2001 09:47 AM

Reading and using a GIF image in Java is easy:

Image im = Toolkit.getDefaultToolkit().getImage("myimage.gif");

You can now display this Image object in your GUI,
manipulate the Image by using classes in the packages
java.awt.image and java.awt.image.renderable,
or even by getting the RGBA values for each pixel and manipulating
these directly.


Java does not have any way for you to re-encode and write
out images in GIF format, so to do this you will need a third-party
class library like the one found at http://www.acme.com/java/software/Acme.JPM.Encoders.GifEncoder.html.

About | Sitemap | Contact