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 | Filtering data with Pandas .query() method
- Python | PIL Attributes
- Accessing Attributes and Methods in Python
- Class & Instance Attributes in Python
- Working with Images in Python
- Reading images in Python
- Python | Grayscaling of Images using OpenCV
- Python | Working with PNG Images using Matplotlib
- How to download Google Images using Python
- Python | Display images with PyGame
- Python | Uploading images in Django
- Extract images from video in Python
- Get emotions of images using Microsoft emotion API in Python
- Python | Intensity Transformation Operations on Images
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.