Refactors Services and Initial Test Implementation

This commit is contained in:
2024-05-21 03:35:24 -03:00
parent b93faf11b3
commit 7eb4d5b64d
21 changed files with 336 additions and 34 deletions

View File

@@ -0,0 +1 @@
from .image_handler import image_validator

View File

@@ -0,0 +1,20 @@
from PIL import Image
import io
def image_validator(file_bytes: io.BytesIO) -> io.BytesIO:
img = Image.open(file_bytes)
img.thumbnail((180, 180))
data = list(img.getdata())
image_without_exif = Image.new(img.mode, img.size)
image_without_exif.putdata(data)
new_byte_img = io.BytesIO()
img.save(new_byte_img, format="PNG")
new_byte_img.seek(0)
return new_byte_img