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.)
<feImage>
Usage context
| Categories | Filter primitive element |
|---|---|
| Permitted content | Any number of the following elements, in any order:<animate>, <animateTransform>, <set>
|
Attributes
crossoriginpreserveAspectRatio-
xlink:hrefDeprecated
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
| Desktop | Mobile | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | |
feImage |
5 | 12 | 3 | 9 | 6 | 18 | 4 | 10.1 | 6 | 1.0 | 4.4 |
crossorigin |
No | No | 114 | No | No | No | 114 | No | No | No | No |
href |
5 | 12 | 3Document fragments (including references to fragments in the current document) are not supported (see bug 455986). |
15 | 6 | 18 | 4Document fragments (including references to fragments in the current document) are not supported (see bug 455986). |
14 | 6 | 1.0 | 4.4 |
preserveAspectRatio |
5 | 79 | 22 | 15 | 6 | 18 | 22 | 14 | 6 | 1.0 | 4.4 |
xlink_href |
5 | 12 | 4Document fragments (including references to fragments in the current document) are not supported (see bug 455986). |
9 | 6 | 18 | 4Document fragments (including references to fragments in the current document) are not supported (see bug 455986). |
14 | 6 | 1.0 | 4.4 |
See also
- SVG Filter primitive attributes
-
flood-colorattribute -
flood-opacityattribute <filter><animate><animateTransform><set><feBlend><feColorMatrix><feComponentTransfer><feComposite><feConvolveMatrix><feDiffuseLighting><feDisplacementMap><feFlood><feGaussianBlur><feMerge><feMorphology><feOffset><feSpecularLighting><feTile><feTurbulence>- SVG tutorial: Filter effects
© 2005–2024 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feImage