OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] SVG and embedded images?

[ Lists Home | Date Index | Thread Index ]

In a message dated 19/10/2002 02:22:59 GMT Daylight Time, andrzej@chaeron.com writes:


Can anyone tell me if it's possible to embed a jpg or gif image (probably
base64 encoded) in an SVG?  If so, what would the tag syntax be for this?

I read the SVG spec....but it seems that you can only refer to an external
bitmapped image.


Andrzej,

Something like this should do it:

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"><image id="AHWCropped" width="813" height="1293"
xlink:href="data:;base64,/9j/4AAQSkZJRgABAgEASABIAAD/4SHDRXhpZgAATU0AKgAAAAgADAEOAAIAAAABAAAAngEPAAIAAAAWAAAA3gEQAAIAAAAmAAAA/gESAAMAAAABAAEAAAEaAAUAAAABAAABLgEbAAUAAAABAAABNgEo"/></svg>

Of course, the data must be much longer to display the original JPEG image correctly. I cut the image data a lot to keep the above short. But it should let you see what you wanted as to syntax.

It is also possible to do this with GIFs and, I think, with PNGs.

I hope that helps.

BTW detailed questions on SVG are probably best sent to the SVG-Developers mailing list at
http://www.yahoogroups.com/group/SVG-Developers

Andrew Watt




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS