ISSUE-2002: Controlling the implicit viewBox of raster images used in the <image> element

Controlling the implicit viewBox of raster images used in the <image> element

State:
RAISED
Product:
SVG 2
Raised by:
Erik Dahlström
Opened on:
2008-05-15
Description:
This is a summary of the thread here[1].

The 1.1 spec says that when an
<image> element references a raster image the implicit 'viewBox' has a
value of "0 0 raster-image-width raster-image-height". This makes it difficult to cut out parts of raster images, such as an image that contains a number of sprite images [2].

Since this implicit viewbox can't be controlled you are forced to use other less intuitive methods (which are usually more expensive, but it may depend on the implementation) of getting the part of the raster image you want. E.g. clip, mask, pattern, clip-path to cut out a part of the image.

Sub-issue #1: "specifying the source rectangle in raster image coordinatespace (i.e. in pixels)"
-------------
There is a need for defining the source rectangle used for the rendering of an <image> element. The destination rectangle is defined by attributes {x,y,width,height} and the positioning within this rectangle is controllable through preserveAspectRatio and the (implicit or explicit) viewBox in the referenced image resource. If the implicit viewBox could be controlled for raster images then you would have full control over what part of the image was drawn.

Sub-issue #2: "allowing percentages resolved relative to the native dimensions of a raster image"
-------------
In some use-cases the size of the raster image is unknown, and in such situations it helps if it's possible to perform calculations based on the native dimensions of the raster image. While it is possible to do this using the 'clip' property, the 'clip' property works in user-space coordinates, not in the raster image coordinate-space (pixels), it doesn't support percentages (this is also a drawback of trying to use the viewBox property for this, if that was picked as a solution for sub-issue #1).

Currently the situation is that you control the destination rectangle, but not the source rectangle for rendering an <image> element.

[1] http://lists.w3.org/Archives/Public/www-svg/2008May/0011.html
[2] http://www.otanistudio.com/swt/sprite_explosions/_i/exp2.png
Related Actions Items:
Related emails:
  1. Minutes Sydney 2009 F2F day 1 (from ed@opera.com on 2009-02-16)
  2. Minutes Feb 12, 2009, telcon (from anthony.grasso@cisra.canon.com.au on 2009-02-13)
  3. Agenda Feb 12, 2009, telcon (from ed@opera.com on 2009-02-12)
  4. Re: Cropping <image>s, ISSUE-2002 (from ed@opera.com on 2009-02-12)
  5. Cropping <image>s, ISSUE-2002 (from cam@mcc.id.au on 2009-02-12)
  6. Minutes, Feb 5, 2009 telcon (from cam@mcc.id.au on 2009-02-06)
  7. Agenda, Feb 5, 2009 telcon (from ed@opera.com on 2009-02-04)
  8. Re: David Dailey's Feature Proposals (from ed@opera.com on 2009-02-02)
  9. Agenda, Jan 29, 2009 telcon (from ed@opera.com on 2009-01-29)
  10. ISSUE-2002: Controlling the implicit viewBox of raster images used in the <image> element [SVG Full 1.2] (from sysbot+tracker@w3.org on 2008-05-15)

Related notes:

No additional notes.

Display change log ATOM feed


Dirk Schulze <dschulze@adobe.com>, Chair, Chris Lilley <chris@w3.org>, Staff Contact
Tracker: documentation, (configuration for this group), originally developed by Dean Jackson, is developed and maintained by the Systems Team <w3t-sys@w3.org>.
$Id: 2002.html,v 1.1 2020/01/17 13:18:49 carcone Exp $