The MDN documentation of the CanvasRenderingContext2D.shadowBlur property states that
this value doesn't correspond to a number of pixels
Some other articles state that it is indeed in pixels, but I'm finding the MDN docs to be correct. Here is a PNG with an alpha channel, rendered on a canvas with shadowBlur set to 15:
And here is the same image rendered as an img element, with a -webkit-filter: drop-shadow()
with the blur-radius
value set to 15px:
It seems clear that the canvas blur is not in pixels, unless there's something wacky going on with Retina, or zoom level, or something else I'm not fully understanding right now.
If I drop the blur-radius
on the drop-shadow()
down to 5px, however, it's a pretty close match to the canvas:
So should blur-radius
always be set to a third of shadowBlur
to achieve parity? Could someone help me understand what's going on here?