Thank you very much, i think it will help; now i should retrieve the base64
string to feed ParsedURL. To retrive the base64 string, i do the following:
......
if (id != null && id.getNodeValue().contains("Picture")) {
     Node grandchild = child.getLastChild();
     NodeList grandchildren = grandchild.getChildNodes();
     if (grandchildren.getLength() == 1) { // base 64 image
         SVGOMImageElement ie = (SVGOMImageElement)
grandchildren.item(0).getLastChild();
......
but after that, i cant get the string with the line "String image =
ie.getHref().getAnimVal();"
would you give any suggestion? 
Best Regards.


Cameron McCormack-4 wrote:
> 
> 
> OK.  You can use the ParsedURL class to get an InputStream from that
> data: URI:
> 
>  
> http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/util/ParsedURL.html
> 
> You can then pass that InputStream to the constructor of
> org.apache.batik.ext.awt.image.codec.png.PNGImageDecoder, then call
> decodeAsRenderedImage(0) on it PNGImageDecoder.  That will return you a
> RenderedImage:
> 
>  
> http://java.sun.com/j2se/1.5.0/docs/api/java/awt/image/RenderedImage.html
> 
> Then you can convert the RenderedImage to a BufferedImage, using code
> like shown here:
> 
>   http://www.jguru.com/faq/view.jsp?EID=114602
> 
> Once you’ve made the changes to your image, use the PNGImageEncoder
> class, which will write the PNG data to an OutputStream.  For that
> OutputStream, supply an instance of Base64EncoderStream that is wrapped
> by a StringWriter.  Then set the @xlink:href attribute of the <image>
> element to be "data:image/png;base64," + yourStringWriter.
> 
> Hope that helps,
> 
> Cameron
> 
> -- 
> Cameron McCormack ≝ http://mcc.id.au/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-export-alter-images%28image-data%29-of-an-svg-file-tp19794886p19840613.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to