<feImage>
Baseline Widely available *
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The <feImage>
SVG filter primitive fetches image data from an external source and provides the pixel data as output (meaning if the external source is an SVG image, it is rasterized.)
Usage context
Categories | Filter primitive element |
---|---|
Permitted content | Any number of the following elements, in any order:<animate> , <animateTransform> , <discard> , <set> |
Attributes
crossorigin
fetchpriority
- : Provides a hint of the relative priority to use when fetching an external image.
Allowed values:
high
-
Fetches the external image at a high priority relative to other external resources.
low
-
Fetches the external image at a low priority relative to other external resources.
auto
-
Doesn't set a preference for the fetch priority. It is used if no value or an invalid value is set. This is the default.
- : Provides a hint of the relative priority to use when fetching an external image.
Allowed values:
preserveAspectRatio
xlink:href
Deprecated
DOM Interface
This element implements the SVGFEImageElement
interface.
Example
SVG
html
<svg
viewBox="0 0 200 200"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="200"
height="200">
<defs>
<filter id="image">
<feImage href="mdn_logo_only_color.png" />
</filter>
</defs>
<rect x="10%" y="10%" width="80%" height="80%" style="filter:url(#image);" />
</svg>
Result
Specifications
Specification |
---|
Filter Effects Module Level 1 # feImageElement |
Browser compatibility
See also
- SVG Filter primitive attributes
flood-color
attributeflood-opacity
attribute<filter>
<animate>
<animateTransform>
<set>
<feBlend>
<feColorMatrix>
<feComponentTransfer>
<feComposite>
<feConvolveMatrix>
<feDiffuseLighting>
<feDisplacementMap>
<feFlood>
<feGaussianBlur>
<feMerge>
<feMorphology>
<feOffset>
<feSpecularLighting>
<feTile>
<feTurbulence>
fetchpriority
attribute- SVG tutorial: Filter effects