I'm applying a blur effect to an image in WPF like so:
<Image ClipToBounds="True">
<Image.Effect>
<BlurEffect Radius="100" KernelType="Gaussian" RenderingBias="Performance" />
</Image.Effect>
</Image>
As you can see, the radius is large, because the image is large and I need it to be really blurry. However, for a radius that large I'm getting a light frame around my image as seen in the attached image. How can I suppress this?
In case you're wondering: The result is the same not matter the RenderingBias
. A border is also produced in quality-mode.
The Gaussian blur is a way to apply a low-pass filter in skimage. It is often used to remove Gaussian (i. e., random) noise from the image. For other kinds of noise, e.g. “salt and pepper” or “static” noise, a median filter is typically used.
2 Correct answersCheck if Effect > Document Raster Effects > White is checked for Background. Start by checking your hardware acceleration settings and also verify the raster effect DPI setting. Reverting to software-only mode or lowering the DPI may fix things.
What's happening is the result of a blur together with the ClipToBounds. Since you're using a Gaussian blur, the edges are going to naturally blend into the background (white).
Applying ClipToBounds basically cuts off where it would otherwise have been blending into the white, hence why you get a white frame.
Unless you're willing to clip the image even more, unfortunately this is just how blurs work.
Before blurring, You can pad the image using the pixels from the image border. By doing that you can assure that the blurred pixels around the border will be blurred using pixels of similar color and the whitish border will be gone. Of course, after blurring crop the image back to its original size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With