blur nativo

This commit is contained in:
José Henrique Ivanchechen 2023-09-27 22:28:52 -03:00
parent 4ef0ab508f
commit b372e1c310
2 changed files with 12 additions and 7 deletions

View File

@ -9,11 +9,13 @@ namespace TCC.Services
public MagickImage BoxBlurImage(Stream imageStream, int radius)
{
var image = new MagickImage(imageStream);
var blurredImage = new MagickImage(image);
image.GaussianBlur(radius, radius);
return image;
//var blurredImage = new MagickImage(image);
blurredImage = BoxBlurImageSeparable(image, blurredImage, radius, 0);
blurredImage = BoxBlurImageSeparable(blurredImage, blurredImage, 0, radius);
return blurredImage;
//blurredImage = BoxBlurImageSeparable(image, blurredImage, radius, 0);
//blurredImage = BoxBlurImageSeparable(blurredImage, blurredImage, 0, radius);
//return blurredImage;
}
private MagickImage BoxBlurImageSeparable(MagickImage image, MagickImage blurredImage, int radiusX, int radiusY)

View File

@ -37,9 +37,12 @@ class ImageService:
def box_blur_image(self, img, radius):
with Image(blob=img) as image:
blurred_image = box_blur_image_separable(image, radius, 0)
blurred_image = box_blur_image_separable(blurred_image, 0, radius)
return blurred_image.make_blob()
image.gaussian_blur(radius, radius)
return image.make_blob()
# blurred_image = box_blur_image_separable(image, radius, 0)
# blurred_image = box_blur_image_separable(blurred_image, 0, radius)
# return blurred_image.make_blob()
def get_simple_image(self):
with open("./static/small-image.png", "rb") as file: