Here's a simple JPEG example:

import java.io.OutputStream;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import com.sun.image.codec.jpeg.JPEGCodec;
import java.awt.image.BufferedImage;

public void writeImage(BufferedImage image, OutputStream out) throws
Exception
 {
  try
  {
   JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
   encoder.encode((BufferedImage) image);
     }
     catch (Throwable t)
     {
      System.out.println(t);
     }
 }


Matt Tucker wrote:

> Hello--
>
> Does anyone have any examples of code that writes images to either a
> .jpg or .gif file? I'm having a very hard time finding any code on the
> net...
>
> Thanks!
> -Matt Tucker
> --
> -------------------------------
>          Matt Tucker
>      [EMAIL PROTECTED]
>  http://cs.uiowa.edu/~matucker
> -------------------------------
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 2D Home Page: http://java.sun.com/products/java-media/2D/

--
.................................................................
Mick Barry                                 Objects Pty Ltd
email: [EMAIL PROTECTED]                 phone: +61 411 265 310
.................................................................
"Beer is proof that God loves us and wants us to be happy"
    - Benjamin Franklin


=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/

Reply via email to