Re: Possible to embed pixmaps in svg files?

Jan Aarsaether wrote:

> I found this interesting link:
> http://www.wdvl.com/Authoring/Languages/XML/SVG/DoingIt/graphic-elts.html
> 
> "This allows you to embed a PNG or JPEG (but not a
> GIF) image within an SVG image.

Yes. We can require JPEG and we can require PNG, but it is hard to
require GIF since that lays implementors - even of freeware - to
financial claims from Unisys.

> Note that you use
> the xlink:href attribute rather than the HTML img src
> attribute to point to the image file.

Right (in other words, this is XML not HTML, and we use XLink).

>  Also note that you
> can specify the precise location of the embedded
> image within the SVG image."

Of course, otherwise all images would be placed in the top left corner
or something ;-)

More interestingly, you can scale, shear, rotate etc the images.

I have attached an sample SVG file which demonstrates these effects on
an image. It also tests compositing against different colored
backgrounds. Its an SVG conversion of an HTML test page for PNG
compositing [1]. Interestingthat even after several years, while pretty
much every browser can display PNG inline, many still have difficulty
gettuing the finer points of compositing correct. There are only two
HTML browsers that I know of which display this page completely
correctly. 

But already, there is at least one SVG implementation - the one from
CSIRO - which displays the SVG version correctly. And I expect the IBM
implementation to pass this once it gets the ability to display PNG at
all, since it already composites SVG shapes correctly. If anyone knows
of another implementation which displays this test file correctly, I
would be interested to hear of it.

> They do not discuss how this is being done in greater detail, 

well, see section 3.7 [2] of the SVG spec for the details.

> nor do
> they offer an example of how to do embedding within a svg file. 

Embed is used in the meaning of HTML - the linked image is "embedded" in
the rendered result. It doesn't mean that the image data is physically
located in the svg file.

[1] http://www.w3.org/Graphics/PNG/inline-alpha-table
[2] http://www.w3.org/TR/SVG/struct.html#ImageElement

--
Chris

Received on Friday, 15 October 1999 11:28:34 UTC