xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: Add IMAGE from BufferedImage into a loaded SVG Document
Date Mon, 14 Feb 2005 15:59:18 GMT
Andres Toussaint wrote:

> My Main question is: How is the best way to add this image into my document?

     Encode it as a PNG and include it in the xlink:href using
the data protocol.  This is what the code below does (very

     The code to do this more directly (take from
batik.svggen.ImageHandlerBase64Encoder) is something like:

     public static final String DATA_PROTOCOL_PNG_PREFIX =

         ByteArrayOutputStream os = new ByteArrayOutputStream();
         Base64EncoderStream b64Encoder = new Base64EncoderStream(os);

         ImageEncoder encoder = new PNGImageEncoder(b64Encoder, null);

         // Close the b64 encoder stream (terminates b64 streams).

                                     DATA_PROTOCOL_PNG_PREFIX +

> Also, will doing this approach create a Embedded Image in my SVG? Or how 
> is the reference to the Image handled? What format of image will be 
> embedded (PNG, JPG,...)?

    The above will embed the image in the SVG.

To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

View raw message