is it possible to have a smooth gradient filter (CSS or SVG) to darken specific parts of an image.
Of course I could create a div apply a linear gradient from black to transparent to it and then set the opacity to 0.4 for example. This is the solution I have right now.
But in my opinion brightness css filter or feComponentTransfer svg filter darken the image way more natural. But I don't want to darken the whole image just parts of it and as described smooth out like a gradient from dark to transparent.
And on top I could of course create this with two images, but I ask myself if it is possible with one image.
Thank you very much for the help in advance.
Best regards Chris
You can do this a few ways - this is the easiest and works cross browser. You define a black/white gradient in the content and import your image via feImage. Then you multiply the gradient with the image (feBlend), clip the gradient to the image with feComposite, and add a feColorMatrix to increase overall brightness (change those 1.5's to whatever you want). Thumbnail of the before is in the corner there.
Of course this means you have to do this within a SVG element. There are ways of doing this as a standalone filter but they might not work in Safari iOS - which (last time I checked anyway) won't let you do feComposite in a filter applied to HTML content.