ImageIO : Java Glossary
home I words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish 2006-02-13 by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
ImageIO
javax.imageio.ImageIO lets you save and restore Images to disk in a platform independent format. It works using plug-in modules that handle various formats including "gif", "png" and "jpeg" (all lower case, or all upper case, but not mixed). "jpeg" or "jpg" is acceptable. Use ImageIO.getWriterFormatNames() to find out which types are supported on your machine.

With ImageIO, instead of Image you use BufferedImage which is a subclass of Image, and can thus be used in any of the familiar tools that work with Images. Introduced with Java 1.4.

raw bytes ⇒ BufferedImage URL ⇒ BufferedImage
Image ⇒ raw bytes Image ⇒ BufferedImage
File ⇒ BufferedImage Learning More
BufferedImage ⇒ File Links

Loading an Image from raw bytes

Here raw bytes represent the image of a *.gif, *.png or *.jpg file in RAM.

Saving an Image to raw bytes

Loading a BufferedImage from a file

// file to BufferedImage
import java.awt.image. BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
...
BufferedImage image = ImageIO.read( new File( "rabbit.jpg" ) );

Saving a BufferedImage to a file

Loading a BufferedImage from an URL

Converting Image to BufferedImage

JAI has a set of

for the much simpler ImageIO class, that will for example let you process TIFF files with ImageIO.

Learning More

Sun’s JDK Technote Guide on imageio packages : available:
Sun’s Javadoc on the ImageIO class : available:

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.17] Spread the Net
You are visitor number 40,654.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/imageio.html J:\mindprod\jgloss\imageio.html