mirror of
https://github.com/ivanch/tcc.git
synced 2025-08-25 15:21:49 +00:00
Add load image, Dockerfile e requirements
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from wand.image import Image
|
||||
|
||||
from static.image_helper import ImageHelper
|
||||
|
||||
|
||||
def box_blur_image_separable(image, blurred_image, radius_x, radius_y):
|
||||
pixels = image.get_pixels()
|
||||
@@ -30,28 +32,38 @@ def box_blur_image_separable(image, blurred_image, radius_x, radius_y):
|
||||
return blurred_image
|
||||
|
||||
|
||||
def save_image(file_stream):
|
||||
with open("image.png", "wb") as file:
|
||||
file.write(file_stream.read())
|
||||
file.close()
|
||||
|
||||
|
||||
class ImageService:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def box_blur_image(self, image, radius):
|
||||
def box_blur_image(self, img, radius):
|
||||
temp_path = 'temp_image.png'
|
||||
image.save(temp_path)
|
||||
img.save(temp_path)
|
||||
|
||||
with Image(filename=temp_path) as img:
|
||||
img.blur(radius, 2) # Apply blur directly to the image object
|
||||
img.blur(radius, 2)
|
||||
blurred_temp_path = 'blurred_temp_image.png'
|
||||
img.save(filename=blurred_temp_path) # Save the modified image
|
||||
img.save(filename='blurred_temp_image.png')
|
||||
return blurred_temp_path
|
||||
|
||||
|
||||
def save_image(self, file_stream):
|
||||
with open("image.png", "wb") as file:
|
||||
file.write(file_stream.read())
|
||||
file.close()
|
||||
|
||||
def get_simple_image(self):
|
||||
return Image(filename='path_to_simple_image.png')
|
||||
with ImageHelper.SimpleImage as img:
|
||||
img = ImageHelper.SimpleImage
|
||||
simple_image = 'simple_image.png'
|
||||
img.save(filename='simple_image.png')
|
||||
return simple_image
|
||||
|
||||
|
||||
def get_big_image(self):
|
||||
return Image(filename='path_to_big_image.png')
|
||||
with ImageHelper.BigImage as img:
|
||||
img = ImageHelper.BigImage
|
||||
big_image = 'big_image.png'
|
||||
img.save(filename='big_image.png')
|
||||
return big_image
|
||||
|
Reference in New Issue
Block a user