W3C home > Mailing lists > Public > www-svg@w3.org > July 2002

Inconsistencies when including content via the image element.

From: Jim Ley <jim@jibbering.com>
Date: Fri, 5 Jul 2002 10:56:02 -0000
Message-ID: <012101c22412$8e281d00$ca969dc3@emedia.co.uk>
To: <www-svg@w3.org>

Hi,

The current handling of raster images in the image element is very
problematical to me, and is inconsistent with the behaviour of svg images
from the image element.

If you include a raster image with a height/width the raster image is
scaled to that height width, indeed it is _impossible_ to use the height
and width that the image defines (an image has a height and width,
forcing this to be known outside of the object itself is wrong and
inconsistent with other mark-up languages, which always have the viewbox
of the image defined by the image itself.)     However if you include an
svg image via the image element the image is not scaled to the height
width set in the image but preserves the sizing inherent to the file,
unless it has a viewBox set.

Consider the 100px by 100px svg image (
http://jibbering.com/2002/7/rect.svg ) :
<svg width="100px" height="100px">
<rect x="0" y="0" height="100px" width="100px" fill="red"/>
</svg>

and the raster 640px by 480px raster image (
http://jibbering.com/imgs/shepherds.jpg )

When you include them in an SVG document like so:
<image xlink:href="http://jibbering.com/imgs/shepherds.jpg" height="500"
width="500"/>
<image xlink:href="http://jibbering.com/2002/7/rect.svg" height="500"
width="500"/>

The raster image is scaled, the SVG image is not.  If you include a
viewBox in the first it would be of course, but why is a raster image
always assumed to have a viewBox equal to its size and an svg image not?

The height and width of an image is a property the image, and I think
it's very important to be able to use these properties - at the moment
they are not available - this means any properties which are defined in
the co-ordinatespace of the image, cannot be mapped to the image unless
we know the size.

Jim.
Received on Friday, 5 July 2002 06:59:05 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:23 GMT