Could you please help me finding out how can I achieve the Sepia tone on the link bellow using SVG?
My Sepia Tone made with Photoshop’s Color Balance
I’ve tried the following code:
<svg class="defs-only">
<filter id="monochrome" color-interpolation-filters="sRGB"
x="0" y="0" height="100%" width="100%">
<feColorMatrix type="matrix"
values="1.00 0 0 0 0
0.80 0 0 0 0
0.65 0 0 0 0
0 0 0 1 0" />
</filter>
</svg>
CSS:
img{
-webkit-filter: url(#monochrome);
filter: url(#monochrome);
}
But the feColorMatrix Sepia Tone that I get is very different and appears not to be only affecting the mid tones as it does on Photoshop.
Note: I can’t use canvas.
2
Answers
I don’t know if you see this, but a feColorMatrix generator exists : https://codepen.io/mullany/pen/qJCDk
You just have to change the image by yours :
You can play with all the parameters like in Photoshop.
Enjoy (ノ≧∀≦)ノ
Well first of all, that’s not a proper sepia filter. It’s only using the red channel as input, so you’re losing about a third of your luminosity off the bat. The “official” W3C sepia filter is:
That gives you this result:
And if you just want to process the mid-tones then you need to pull the mid-tones out and process them separately. That looks like this:
And gives you something that looks like this:
The magic here is the settings for feFuncA – which controls how wide the mid-tone selection is. “0 .2 0.5 1 1 1 0.5 .2 0” is a pretty wide selection – so if you want a narrower range given the sepia treatment, you might want to use something like “0 0 0 0.2 0.5 1 0.5 0.2 0 0 0” – play with it until you have something you like.
http://codepen.io/mullany/pen/rjdYre?editors=1000#