Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evuez/python-rescale
:snake: :package: A simple tool to resize and crop an image
https://github.com/evuez/python-rescale
Last synced: about 1 month ago
JSON representation
:snake: :package: A simple tool to resize and crop an image
- Host: GitHub
- URL: https://github.com/evuez/python-rescale
- Owner: evuez
- License: mit
- Created: 2014-05-23T12:49:54.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-04T10:26:24.000Z (over 9 years ago)
- Last Synced: 2024-10-09T09:51:36.022Z (about 1 month ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/rescale
- Size: 148 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
python-rescale
==============A simple tool to resize and crop an image
```
rescale(image, size, mode=None)
```* image: a PIL image object
* size: a 2-tuple (width, height); at least one must be specified
* mode: `CROP_TL` or `CROP_BR`If no height or no width is specified, the mode won't be taken into account, and the image will just be resized.
If both width and height are provided, and the mode is set top `CROP_TL` or `CROP_BR`, the image will be cropped to the given size using the given mode. Note that the crop is made after the image as been resized (well not exactly, but the result is the same) to preserve as much as possible the content of the image.
The resize is made so that the original ratio is preserved.
The `CROP_TL` mode will keep the top left or the image, while `CROP_BR` will keep the bottom right of it.