diff --git a/compress_image/README.md b/compress_image/README.md new file mode 100644 index 0000000..be9985c --- /dev/null +++ b/compress_image/README.md @@ -0,0 +1,15 @@ +## What it does ## + +Compress image using PIL (Pillow) + +## Install ## + +``` +pip install Pillow +``` + +## How to use ## + +``` +python compress.py +``` \ No newline at end of file diff --git a/compress_image/compress.py b/compress_image/compress.py new file mode 100644 index 0000000..8387420 --- /dev/null +++ b/compress_image/compress.py @@ -0,0 +1,9 @@ +import sys +from PIL import Image + +img_src = sys.argv[1] +img_dst = sys.argv[2] +quality = int(sys.argv[3]) + +img = Image.open(img_src) +img.save(img_dst, optimize=True, quality=quality) \ No newline at end of file