title image


Smiley Hilfsklasse ImageIO
Stand-alone lauffähig unter Verwendung von Quellcode aus Javainsel:



import java.awt.*;

import java.awt.image.*;

import java.io.*;

import javax.imageio.*;



public class CImage

{

private void write( String sFileName, String sFileType )

{

try

{

BufferedImage bi = new BufferedImage( 100, 100, BufferedImage.TYPE_INT_RGB );

Graphics2D g2d = bi.createGraphics();

g2d.fillOval( 0, 0, 100, 100 );

g2d.dispose();



File datei = new File( sFileName + "." + sFileType );

BufferedOutputStream oStream = new BufferedOutputStream( new FileOutputStream(datei) );

ImageIO.write( bi, sFileType, oStream );

}

catch( IOException e1 )

{

System.out.println( "Mecker" );

}

catch( Exception e2 )

{

System.out.println( "Nochmal Mecker" );

}

}



public static void main( String[] saArgs )

{

CImage oImage = new CImage();

oImage.write( "C:\\x", "png" );

}

}





geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: