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 0 and can be changed 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.3.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: BulkImageResizer-1.0.3.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.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for BulkImageResizer-1.0.3.tar.gz
Algorithm Hash digest
SHA256 344d32db2fcbda834e80c2b9365a7c15c03f023c12d9c205cf585dcaad7f21bc
MD5 09dfa977ed2ff0acb9c842f6ab9a4803
BLAKE2b-256 a0c30008a36c7c2da37d93bfdda8fae709fd3de7d198bed5a1b48782b47b82e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: BulkImageResizer-1.0.3-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.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for BulkImageResizer-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 daa491a06711edde4d1be93081836b18011445e83e7dceb8204c505ca47ffea6
MD5 c5883b89507d4c3977c0ade115daa514
BLAKE2b-256 171709f9fae1b7fb5bb7bf325137a67e9cc0af8f01557cd60d8027412b949d9f

See more details on using hashes here.

Supported by

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