mirror of https://github.com/ivanch/tcc.git
blur nativo
This commit is contained in:
parent
4ef0ab508f
commit
b372e1c310
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue