Last active
February 4, 2019 19:44
-
-
Save thejsj/e5f9ed0a4d259ac3c8d1678a9c65337a to your computer and use it in GitHub Desktop.
Pillow Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
virtualenv -p python3 venv # Delete Later with `rm -rf venv` | |
source venv/bin/activate | |
pip install Pillow | |
python -c "from PIL import Image; import urllib.request; urllib.request.urlretrieve('https://images.unsplash.com/photo-1518791841217-8f162f1e1131', '/tmp/cat.jpg'); im = Image.open('/tmp/cat.jpg'); im.thumbnail((256, 256)); im.save('/tmp/cat-resize.jpg', 'JPEG'); im = Image.open('/tmp/cat-resize.jpg'); print(im.format, im.size, im.mode)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python --version # 2.x | |
pip install Pillow | |
python -c "from PIL import Image; import urllib; urllib.urlretrieve('https://images.unsplash.com/photo-1518791841217-8f162f1e1131', '/tmp/cat.jpg'); im = Image.open('/tmp/cat.jpg'); im.thumbnail((256, 256)); im.save('/tmp/cat-resize.jpg', 'JPEG'); im = Image.open('/tmp/cat-resize.jpg'); print(im.format, im.size, im.mode)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python --version # 3.x | |
pip install Pillow | |
python -c "from PIL import Image; import urllib.request; urllib.request.urlretrieve('https://images.unsplash.com/photo-1518791841217-8f162f1e1131', '/tmp/cat.jpg'); im = Image.open('/tmp/cat.jpg'); im.thumbnail((256, 256)); im.save('/tmp/cat-resize.jpg', 'JPEG'); im = Image.open('/tmp/cat-resize.jpg'); print(im.format, im.size, im.mode)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment