Simple image manipulate based on PIL.
Project description
Eirx - Easy Image Resizer ===
Resize image in an easy way.
Installation ===
$ pip install eirx
Usage ===
$ eirx MODE SRC DEST # convert image $ eirxv MODE SRC # view converted image
where MODE is in a form like size-options or size only.
size should be one of the following format
wWIDTHhHEIGHT : to certain width and height (e.g. w200h300 means 200px in width and 300px in height)
wWIDTH : to certain width (and the adjust height option will automatically set in this mode)
hHEIGHT : to certain height (and the adjust width option will automatically set in this mode)
LENGTH : to square, with side length set (and the central crop option will automatically set in this mode)
options is a string, each character represent an option, the rule is
a : absolute size; will clear the adjust height or width options
c : central crop; if the output size is less than the image size, only central part of the image is used (not resize or scratch the image)
f : framed mode; scratch the image to output size, with aspect ratio kept; then paste the scratched to the center of the output, and fill the rest part with a certain color
F : set filling color to white (with Fw), black (Fb) or customized (FxRRGGBB)
SRC and DEST are files.
For example
$ eirx w200h400 hello.png output.png $ eirx w200 hello.png output.png $ eirx w1280h720-Fwc hello.png output.png $ eirxv w200h400-c hello.png $ eirxv w200-a hello.png $ eirxv 400-fFx1010cc hello.png
Quick Start API ===
>>> from eirx.parse import parse >>> from eirx.api import adjust, trans_file >>> from PIL import Image >>> >>> args = parse('w200h300') >>> im = adjust(Image.open('hello.png'), **args) >>> im.show() >>> >>> im = trans_file('hello.png', 'w200h300') >>> im.save('output.png')
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
File details
Details for the file eirx-0.21.tar.gz
.
File metadata
- Download URL: eirx-0.21.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4529d93bff2284daa4db2d75b9fb7fa16a2573c57e689d601d759518c61c374e |
|
MD5 | 6c76e2f4a95b91649aa72c46a62ff8df |
|
BLAKE2b-256 | 1e1223c2e4c9a5d5c6e9e48c784a686edecef1385b05535cf2ab56708ed9a45d |