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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file BulkImageResizer-1.0.4.tar.gz.

File metadata

  • Download URL: BulkImageResizer-1.0.4.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for BulkImageResizer-1.0.4.tar.gz
Algorithm Hash digest
SHA256 ba4baafc174382784809f777a3ad9983d84ad68aa6c35f489e8e7a75ebee089d
MD5 5835e4a0ba9893638bd6acb403fa2db1
BLAKE2b-256 e384cab3868b66d4c70930eee05ba16fb948fd5ff39dfea5349f01ac7135a174

See more details on using hashes here.

File details

Details for the file BulkImageResizer-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: BulkImageResizer-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for BulkImageResizer-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 574a97669ed2dd4025e96557434c4c5f03c3760d3eabdb1f7d9ce0fb46be8e92
MD5 ee5c58651dd8dc2dd80781f76ff4dc06
BLAKE2b-256 17d7c2557bbffebb6cec042246f2cabbdd09c243fb4fe0a80a8ee0302b27e75b

See more details on using hashes here.

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