Prerequisite : PIL_working-images-python
Given an Image directory, our program will create a new image directory based on given threshold size.
A simple Python3 function that inputs the path of python file, the threshold width in pixels and the threshold height in pixels, searches all the images present in that only directory and creates a new directory having filtered out all the images according the given threshold size, or resizes it to the given threshold width and height.
Steps to Follow :
1. Install necessary Libraries like PIL
2. Import libraries : PIL, shutil, os, os.path
3. Save the code as sizeFilter.py
4. Open Terminal (where the python file is present and run)-> python sizeFilter.py
Below is the Python3 implementation of above approach :
- Project Idea | (Model based Image Compression of Medical Images)
- Python | Bilateral Filtering
- Python | Filtering data with Pandas .query() method
- Python | PIL Attributes
- Class & Instance Attributes in Python
- Accessing Attributes and Methods in Python
- Python PIL Attributes | Image.height method
- Python PIL Attributes | Image.width Method
- Reading images in Python
- Working with Images in Python
- Apply changes to all the images in given folder - Using Python PIL
- How to download Google Images using Python
- Python | Grayscaling of Images using OpenCV
- Extract images from video in Python
- Python | Working with PNG Images using Matplotlib
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.