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 text using Enchant
- Python - Sharpen and blur filtering using pgmagick
- Python | Filtering data with Pandas .query() method
- Python | PIL Attributes
- Dynamic Attributes in Python
- Accessing Attributes and Methods in Python
- How to Get a List of Class Attributes in Python?
- Class and Instance Attributes in Python
- Python PIL Attributes | Image.width Method
- Python PIL Attributes | Image.height method
- Working with Images in Python
- Reading images in Python
- Arithmetic Operations on Images using OpenCV | Set-2 (Bitwise Operations on Binary Images)
- Working with Images in Python using Matplotlib
- Reading Images With Python - Tkinter
- How to download Google Images using Python
- Extract images from video in Python
- Python | Uploading images in Django
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.