some useful snippet for image
Project description
pillow_snippet
some useful snippet and utils using pillow to handle image
Requirements
- Pillow
Install
pip install pillow-snippet
Documentation
Tutorial
- origin image
- origin image2
- convert an Image to a circled Image
from pillow_snippet import convert
origin_image = Image.open('colorful_example.png')
image = origin_image.resize((200, 200))
circle_image = convert.circle_image(image)
circle_image.save("test_result/circle_image.png")
- delete the white pixel from an image
it seems there is still white but if fact it is transparent. You can open the image in new tab to see more details
mask = Mask(image)
exclude_white_image = mask.get_exclude_white_image(tolerance=8)
exclude_white_image.save("test_result/exclude_white_image.png")
- convert the image to only contains red color according it's brightness
mask = Mask(image)
change_to_red_image = mask.convert_to_single_color("#ff0000ff")
change_to_red_image.save("test_result/change_to_red_image.png")
- convert the imge to only contains green color according it's opacity instead of it's brightness
mask2 = Mask(origin_image2)
change_to_green_image = mask2.convert_to_single_color("#00ff00ff", mode="L")
change_to_green_image.save("test_result/change_to_green_image_L.png")
change_to_green_image = mask2.convert_to_single_color("#00ff00ff", mode="opacity")
change_to_green_image.save("test_result/change_to_green_image_opacity.png")
compare difference mode
* mode = "L"
* mode = "opacity"
Contribution
- clone the code
- make your commit
- make test
sudo pip install .
python3 test.py
- create a pull request
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size pillow_snippet-0.0.4-py3-none-any.whl (4.4 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size pillow-snippet-0.0.4.tar.gz (2.9 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for pillow_snippet-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6239776b63b8014d94a2b15f55803f2022ae7b58ac43fb9453523f8c6238ce4f |
|
MD5 | 6622afdd7942fc9eba9a737dde352206 |
|
BLAKE2-256 | badf81710501c64cd866644fb84abc3ab071d7b50e137a971eb8f0abb905987d |