Skip to main content

Resizes any number of images, written to use in responsive front end web development

Project description

# BulkImageResizer

BulkImageResizer automates image resizing and compression of any number of images in a folder. I developed this script to automatically resize and compress the images for responsive front end web development.

## Getting Started

Followig instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

### Prerequisites

No prerequisites. BulkImageResizer is compatible with both Python2 and Python3.

### Installation

* Basic installation on your default Python version. Type in following code on your terminal:
```
$ pip install BulkImageResizer
```
If you want to install on a different Python version than default then:
* if default is Python2, then to install on Python3:
```
$ python3 -m pip install BulkImageResizer
```
* if default is Python3, then to install on Python2:
```
$ python2 -m pip install BulkImageResizer
```

## Usage

1. First import the module using the following command on your python project.
```
from BulkImageResizer.BulkImageResizer import BulkImageResizer
```
2. Instantiate BulkImageResizer object with the following arguments:
* path to source folder (containing images)
* path to new folder (to save resized images).
here is an example:
```
sourceFolder = '/Users/SK/Desktop/sourceFolder/'
exportFolder = '/Users/SK/Desktop/exportFolder/'

test1 = BulkImageResizer(sourceFolder, exportFolder)
```
3.1 To resize the image use imageResize() method. It takes minimum two integer numbers as arguments, which indicates the size you want in pixels.
here is an example:
```
test1.imageResize(800, 600)
```
this will resize all the images in the sourceFolder according to given pixels and save them in exportFolder. The original photos in the sourceFolder will not change.
If you want to keeps aspect ratio unchanged then use the following:
```
test1.imageResize(800, 600, aspectRatio=False)
```
this will resize all the images in the sourceFolder so that no matter what the length of the longer side of the image will equal 800px and the length of the shorter side of the image will be calculated based on the aspect ration of the original image. The resized images will be saved in exportFolder.
You can also change the subsampling value and quality of the image. By default subsampling is set to 1 and can be changed from 0 up to 2. Quality is set to 95, which is the maximum quality and can be lowered if you would like to compress the image and decrease file size.
```
test1.imageResize(800, 600, subsampling=2, quality=85)
```
3.2 If you want to just comress the photo without changing the pixel size then you can use imageCompress() method. By default quality is set to 95. If you would like to decrease the file size then you can lower the quality.
```
test1.imageComress(quality=75)
```

## Contributing

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

## Version

Current Version: 1.0.3. For the versions available, see the [tags on this repository](https://github.com/suhrabjan/BulkImageResizer/tags).

## Authors

**Suhrab Kurbanov** - *Initial work*
See also the list of [contributors](https://github.com/suhrabjan/BulkImageResizer/graphs/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgements

Hat tip to anyone whose code was used


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BulkImageResizer-1.0.4.tar.gz (3.1 kB view hashes)

Uploaded source

Built Distribution

BulkImageResizer-1.0.4-py3-none-any.whl (3.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page