diff --git a/dependencies.md b/dependencies.md new file mode 100644 index 0000000..754d7fd --- /dev/null +++ b/dependencies.md @@ -0,0 +1,7 @@ +# Dependecies + +In order to get compression to work you need to install following binaries and make them directly available on your machine: + +* exiftool +* jpegoptim +* optipng diff --git a/extensions/photos.py b/extensions/photos.py index 990af35..170e36e 100644 --- a/extensions/photos.py +++ b/extensions/photos.py @@ -29,8 +29,10 @@ async def compress_image(image_path: str): size_before = path.getsize(image_path) / 1024 + system(f"exiftool -overwrite_original -all:all= -tagsFromFile @ -exif:Orientation {image_path}") + if image_type == "image/jpeg": - system(f"jpegoptim {image_path} -o --max=60 --strip-all") + system(f"jpegoptim {image_path} -o --max=55 -p") elif image_type == "image/png": system(f"optipng -o3 {image_path}")