Filter apply matrix transformation for calculate new values for RGBA and alpha for each pixel
Types
Example for no effect with type="matrix":
<defs> <filter id="MyFilter" filterUnits="userSpaceOnUse" x="0" y="0" width="400" height="400"> <feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"/> </filter> </defs> <image filter="url(#MyFilter)" x="0" y="0" width='400' height='400' xlink:href='fondu1.jpg'/>
<defs> <filter id="MyFilter" filterUnits="userSpaceOnUse" x="0" y="0" width="400" height="400"> <feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"/> </filter> <image id="MyImage" width='400' height='400' xlink:href='puzzle.jpg'/> </defs> <use filter="url(#MyFilter)" xlink:href='#MyImage' x='0' y='0'/>
In this example, as in attribute is not given, filter primitive apply to #MyImage called in use element.
<defs> <filter id="MyFilter" filterUnits="userSpaceOnUse" x="0" y="0" width="400" height="400"> <feImage xlink:href='puzzle.jpg' result="Image"/> <feColorMatrix in="Image" type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"/> </filter> </defs> <use filter="url(#MyFilter)" x='0' y='0'/>
This code give same result. Use element call no image, you have to create
raster for feColorMatrix.
As feColorMatrix don't accept reference to external image, you use feImage to
create raster named "Image".
Figure 1: Some effects with feColorMatrix
See examples of effects on a JPEG picture as SVG
Tool to modify type, parameters, see matrix values and result
FrontPage feColorMatrix feComponentTransfer feSpecularLightning feDiffuseLightning feSpotLight feDistantLight fePointLight feFlood feImage feTurbulence feTile feMerge feBlend feComposite feGaussianBlur feMorphology feConvolveMatrix feDisplacementMap feOffset