[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: SVG and embedded images?


svg embedded image
In a message dated 19/10/2002 02:22:59 GMT Daylight Time, andrzej@c... 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.