SVG filters feDisplacementMap same inputs, different result

Viewed 38

I have a filtered image rendering as expected here.

  • feImage = imageA
  • img element = imageB
  • in = feImage
  • in2 = SourceGraphic

However, if I swap the images around but maintain the same input values here:

  • feImage = imageB
  • img element = imageA
  • in = SourceGraphic
  • in2 = feImage

The result is different. This doesn't make sense to me.

1 Answers

Per the SVG specification

The ‘color-interpolation-filters’ property only applies to the ‘in2’ source image and does not apply to the ‘in’ source image. The ‘in’ source image must remain in its current color space.

So in2 has to be converted to the linearRGB colour space (since that's the default value for color-interpolation-filters), while the in input is RGB because images are RGB by definition. Some UAs may not be doing this properly because it certainly looks the same in Firefox.

Related