From 4656a67b81ffd21d13d445a465e8950d586eeeec Mon Sep 17 00:00:00 2001 From: Atughara2021 Date: Tue, 13 Feb 2024 02:14:32 +0600 Subject: [PATCH 1/5] initialization --- Applications/ImageCompressor/image_compressor.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Applications/ImageCompressor/image_compressor.py diff --git a/Applications/ImageCompressor/image_compressor.py b/Applications/ImageCompressor/image_compressor.py new file mode 100644 index 0000000..fbcdf7c --- /dev/null +++ b/Applications/ImageCompressor/image_compressor.py @@ -0,0 +1,5 @@ +from PIL import Image +import os +import easygui +from easygui import * + From 49701fcc4ae1b13be0e899697e10fe12cf532e4c Mon Sep 17 00:00:00 2001 From: Atughara2021 Date: Thu, 15 Feb 2024 01:16:32 +0600 Subject: [PATCH 2/5] resize functionality --- .../ImageCompressor/image_compressor.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Applications/ImageCompressor/image_compressor.py b/Applications/ImageCompressor/image_compressor.py index fbcdf7c..3e61bd7 100644 --- a/Applications/ImageCompressor/image_compressor.py +++ b/Applications/ImageCompressor/image_compressor.py @@ -3,3 +3,34 @@ import easygui from easygui import * +def resizer(): + print("Please select the image you want to compress") + image_file = easygui.fileopenbox() + filepath = os.path.join(os.getcwd(), image_file) + + filename, filextension = os.path.splitext(image_file) + img = Image.open(filepath) + text = "Enter quality on a scale of 10 to 100 (default value is 50)" + + if filextension == ".jpeg" or filextension == ".jpg": + qual = integerbox(text,50,lowerbound=10,upperbound=100) + img.save( + filename + "_compressed" + ".jpeg", + "JPEG", + optimize= True, + quality = qual + ) + msgbox("Your compressed image has been saved in the orignal image folder") + + elif filextension == ".png": + img.convert("P", palette=Image.ADAPTIVE,colors=256) + img.save(filename+"_compressed"+".png",optimize=True,quality = 10) + msgbox("Please note that due to the file format being png it may not get compressed much") + msgbox("Your compressed image has been saved in the orignal image folder") + + else: + print("Invalid filetype") + + return + +resizer() \ No newline at end of file From f5c34697167c62b912573ae15d9eea894611b1f0 Mon Sep 17 00:00:00 2001 From: Atughara2021 Date: Fri, 16 Feb 2024 12:16:32 +0600 Subject: [PATCH 3/5] description of the app --- Applications/ImageCompressor/README.md | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Applications/ImageCompressor/README.md diff --git a/Applications/ImageCompressor/README.md b/Applications/ImageCompressor/README.md new file mode 100644 index 0000000..03af373 --- /dev/null +++ b/Applications/ImageCompressor/README.md @@ -0,0 +1,29 @@ + +![Star Badge](https://img.shields.io/static/v1?label=%F0%9F%8C%9F&message=If%20Useful&style=style=flat&color=BC4E99) +![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103) + +# Image Compressor + +## 🛠️ Description + +The image resizer takes in an image and reduces it's disk size according to the quality you choose, the compressed image is saved in the folder of the orignal image + + + +## ⚙️ Languages or Frameworks Used + +Modules required to be able to use the script successfully +`pillow`, `os`, `easygui` + +These modules are listed in `requirements.txt` and can be installed by running the following command `pip install requirements.txt` + +## 🌟 How to run + +:Simply run the script + + +## 🤖 Author + +If you have any doubts or tips feel free to ping me on discord +dumb_potato#1734 + From c36ef38716583d522b79dd086fbfc48480262f83 Mon Sep 17 00:00:00 2001 From: Atughara2021 Date: Fri, 16 Feb 2024 01:16:32 +0600 Subject: [PATCH 4/5] README update --- Applications/ImageCompressor/README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Applications/ImageCompressor/README.md b/Applications/ImageCompressor/README.md index 03af373..72739cd 100644 --- a/Applications/ImageCompressor/README.md +++ b/Applications/ImageCompressor/README.md @@ -1,7 +1,3 @@ - -![Star Badge](https://img.shields.io/static/v1?label=%F0%9F%8C%9F&message=If%20Useful&style=style=flat&color=BC4E99) -![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103) - # Image Compressor ## 🛠️ Description @@ -22,8 +18,4 @@ These modules are listed in `requirements.txt` and can be installed by running t :Simply run the script -## 🤖 Author - -If you have any doubts or tips feel free to ping me on discord -dumb_potato#1734 From 16df4916c0768eb41e17dcfe2e6e642151df4a69 Mon Sep 17 00:00:00 2001 From: Atughara2021 Date: Mon, 19 Feb 2024 11:10:45 +0600 Subject: [PATCH 5/5] requirements file added --- Applications/ImageCompressor/README.md | 3 +++ Applications/ImageCompressor/requirements.txt | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 Applications/ImageCompressor/requirements.txt diff --git a/Applications/ImageCompressor/README.md b/Applications/ImageCompressor/README.md index 72739cd..9c34a54 100644 --- a/Applications/ImageCompressor/README.md +++ b/Applications/ImageCompressor/README.md @@ -18,4 +18,7 @@ These modules are listed in `requirements.txt` and can be installed by running t :Simply run the script +## 🤖 Author + +If you have any doubts or tips feel free to ping me on discord diff --git a/Applications/ImageCompressor/requirements.txt b/Applications/ImageCompressor/requirements.txt new file mode 100644 index 0000000..cd4c0fc --- /dev/null +++ b/Applications/ImageCompressor/requirements.txt @@ -0,0 +1,3 @@ +os +pillow +easygui \ No newline at end of file