Re: Inconsistencies when including content via the image element.

On Wednesday, November 13, 2002, 12:29:14 PM, Jim wrote:

JL> "Chris Lilley" <chris@w3.org>
>> Hello Jim, www-svg,
>>
>>  You wrote
>>  http://lists.w3.org/Archives/Public/www-svg/2002Jul/0011.html
>>
>> > The current handling of raster images in the image element is very
>> > problematical to me, and is inconsistent with the behaviour of svg
JL> images
>> > from the image element.
>>
>> Its not really inconsistent, it was designed that way, but there are
>> more cases to consider with SVG images. Raster images do not have a
>> viewBox, usually do not have fixed physical dimensions (rather, they
>> just say how many pixes wide and high they are) and generally say
>> nothing about whether aspect ratio should be preserved or not.

JL> I do not agree that images "usually do not have physical dimensions", the
JL> SVG specification requires JPEG and PNG, which are specified in
JL> http://www.w3.org/TR/REC-png.html
JL> and
JL> http://www.w3.org/Graphics/JPEG/jfif3.pdf
JL> and these both clearly show that part of the file format is the physical
JL> dimension of the image,

OK, take a sample of 100 random PNG and JPEG images and tell me how
many of them give you information to deduce a printed width in
millimetres.

JL> and the majority of image editors that I can see
JL> make use of this image.

Not sure what you mean there.

>> Thus, when including a raster image, SVG treats it as it would treat
>> an SVG image with a predefined, implicit, viewBox corresponding to the
>> pixel dimensions and an implicit preserveAspectRatio.

JL> Can you clarify what should happen in the following situation:

JL>   <image xlink:href="rect.svg" x="10" y="10" height="200" width="200"/>
JL>   <image xlink:href="rect.png" x="10" y="200" height="200" width="200"/>

JL> both images are 100px by 100px, the SVG version is:
JL> <svg xmlns="http://www.w3.org/2000/svg" height="100" width="100">
JL>   <title>Rectangle</title>
JL>   <rect x="0" y="0" height="100" width="100"/>
JL> </svg>

See, you keep comparing apples and oranges. You link to a PNG image
without saying whether it contains a pHYS chunk (probability is that
it hasn't, though) and then you link to an SVG image that has no
viewBox but does have a physical dimension; naturally these give
different results.

JL> How large should the 2 rectangles appear on screen, it was my
JL> understanding that the svg created rectangle would still be a 100px
JL> square, but the png rectangle would be a 200px square, the ratio isn't
JL> the problem I have it's the scaling.

So make your svg

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">

and then it will be a nicely scalable, scalable vector graphic. And
will be 200px when referenced, if that is how big the referencing SVG
tells it to be.

>> SVG images can have all of that information. People want to make SVG
>> images that are flexible to include in other content, and also people
>> want to re-use existing content by including it at a different size,
>> without rewriting it.

JL> Indeed, however this has nothing to do with my request, it's simple to
JL> scale etc. both raster and svg images without rewriting them.  The
JL> inability to include an image at its size in SVG is a big problem,

So, you are saying that SVG should understand all the different and
incompatible ways that people have of conveying desired print sizes in
all raster image formats, and display the raster image at that size?

JL> there
JL> are many systems which produce raster image+coordinates which wish to be
JL> used in SVG, we can't do that unless we also know the size of the raster
JL> image outside of the SVG, this is the problem, and the above does nothing
JL> to address it.

An example of such a system would help clarify the problem you are
seeing here.



-- 
 Chris                            mailto:chris@w3.org

Received on Wednesday, 13 November 2002 06:45:21 UTC