KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > imageio > ImageIO

javax.imageio
Class ImageIO

java.lang.Object
  extended by javax.imageio.ImageIO
See Also:
Top Examples, Source Code

public static ImageInputStream createImageInputStream(Object input)
                                               throws IOException
See Also:
ImageInputStreamSpi, IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static ImageOutputStream createImageOutputStream(Object output)
                                                 throws IOException
See Also:
ImageOutputStreamSpi, IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static File getCacheDirectory()
See Also:
setCacheDirectory(java.io.File)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static ImageReader getImageReader(ImageWriter writer)
See Also:
ImageWriterSpi.getImageReaderSpiNames(), getImageWriter(ImageReader), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Iterator<ImageReader> getImageReaders(Object input)
See Also:
ImageReaderSpi.canDecodeInput(java.lang.Object), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Iterator<ImageReader> getImageReadersByFormatName(String formatName)
See Also:
ImageReaderWriterSpi.getFormatNames(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[501]GetImageReadersByFormatName
By wade { dot } li { at } hauinet { dot } com on 2003/11/09 22:13:22  Rate
Iterator readers = ImageIO.getImageReadersByFormatName ( "bmp" ) ; 
 ImageReader reader =  ( ImageReader ) readers.next (  ) ;


[1961]
By Anonymous on 2008/03/25 01:37:03  Rate
yugiytgjhhg87yu

public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType)
See Also:
ImageReaderWriterSpi.getMIMETypes(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix)
See Also:
ImageReaderWriterSpi.getFileSuffixes(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader,
                                                            ImageWriter writer)
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static ImageWriter getImageWriter(ImageReader reader)
See Also:
ImageReaderSpi.getImageWriterSpiNames(), getImageReader(ImageWriter), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type,
                                                    String formatName)
See Also:
ImageWriterSpi.canEncodeImage(ImageTypeSpecifier), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Iterator<ImageWriter> getImageWritersByFormatName(String formatName)
See Also:
ImageReaderWriterSpi.getFormatNames(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType)
See Also:
ImageReaderWriterSpi.getMIMETypes(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix)
See Also:
ImageReaderWriterSpi.getFileSuffixes(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static String[] getReaderFormatNames()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static String[] getReaderMIMETypes()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static boolean getUseCache()
See Also:
setUseCache(boolean)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static String[] getWriterFormatNames()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[95]To learn which image formats you have installed
By Anonymous on 2002/10/17 17:54:06  Rate
//To learn which image formats you have installed, 
  
  
 try  {  
   String [  ]  names = ImageIO.getWriterFormatNames (  ) ; 
   for ( int i=0; i  <  names.length; i++ )   {  
     System.out.println ( names [ i ]  ) ;  
    }  
  }   
 catch ( Exception ex )   {   }  
  
  
 


public static String[] getWriterMIMETypes()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static BufferedImage read(File input)
                          throws IOException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static BufferedImage read(InputStream input)
                          throws IOException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static BufferedImage read(URL input)
                          throws IOException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1915]Download an image from a website, and save it to a file
By Anonymous on 2007/08/06 22:39:35  Rate
// Create a URL for the image's location 
     URL url = new URL ( "http://kickjava.com/image.jpg" ) ; 
  
  
     // Get the image 
     java.awt.Image image = ImageIO.read ( url ) ; //java.awt.Toolkit.getDefaultToolkit (  ) .createImage ( url ) ; 
     int w = image.getWidth ( null ) ; 
     int h = image.getHeight ( null ) ; 
  
  
     BufferedImage bi = new BufferedImage ( w, h, BufferedImage.TYPE_INT_RGB ) ; 
     Graphics2D g2 = bi.createGraphics (  ) ; 
     g2.drawImage ( image, 0, 0, null ) ; 
     g2.dispose (  ) ; 
     g2 = null; 
     ImageIO.write ( bi, "jpg", new File ( "output.jpg" )  ) ;


public static BufferedImage read(ImageInputStream stream)
                          throws IOException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static void scanForPlugins()
See Also:
ClassLoader.getResources(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static void setCacheDirectory(File cacheDirectory)
See Also:
getCacheDirectory(), File.createTempFile(String, String, File), IllegalArgumentException, SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static void setUseCache(boolean useCache)
See Also:
getUseCache()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static boolean write(RenderedImage im,
                            String formatName,
                            File output)
                     throws IOException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[97]Write out an image
By Anonymous on 2004/05/26 20:27:09  Rate
/** To write out your images you need to have the security privileges to do this.  
   * Most Applets  ( unless they're signed )  do not have the ability to do this.  
   * You need to create an application to be able to write images. 
  
  
   * the file you want to write to must already exist before you try to write the image to it.  
   **/
 
  
  
 import java.io.*; and javax.imageio.* 
 File f = new File ( "imagefilename.jpg" ) ; 
 FileOutputStream fout = new FileOutputStream ( f ) ; 
 fout.close (  ) ; 
 ImageIO.write ( img, "jpg", f ) ; // your image must exist, too!  
  
  
 


public static boolean write(RenderedImage im,
                            String formatName,
                            OutputStream output)
                     throws IOException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static boolean write(RenderedImage im,
                            String formatName,
                            ImageOutputStream output)
                     throws IOException
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1912]Download and save an image
By Anonymous on 2007/08/05 21:16:48  Rate
            // Create a URL for the image's location 
             URL url = new URL ( "http://kickjava.com/myimage.jpg" ) ; 
          
             // Get the image 
             java.awt.Image image = java.awt.Toolkit.getDefaultToolkit (  ) .getDefaultToolkit (  ) .createImage ( url ) ; 
             int w = image.getWidth ( null ) ; 
             int h = image.getHeight ( null ) ; 
             BufferedImage bi = new BufferedImage ( w, h, BufferedImage.TYPE_INT_RGB ) ; 
  
  
             ImageIO.write ( bi, "jpg", new File ( "imageTest.jpg" )  ) ;

Popular Tags