Pillow
lastmod 2025-05-16created 2015-10-148 edits
This is the home of Pillow, the friendly PIL fork. PIL is the Python Imaging Library.
If you have ever worried or wondered about the future of PIL, please stop. We're here to save the day.
Require
Many of Pillow’s features require external libraries:
- libjpeg
- zlib
- libtiff
- libfreetype
- littlecms
- libwebp
- tcl/tk
- openjpeg
ImageFont
from PIL import Image, ImageDraw, ImageFont
img = Image.open('memi.jpg').convert('RGB')
img.show()
color = (0,255,0)
width = 3
bbox = (100,100,300,300)
text_pos = (bbox[0]+width,bbox[1])
font_size = 15
font = ImageFont.truetype("arial.ttf", font_size) # arial.ttf 글씨체, font_size=15
draw = ImageDraw.Draw(img)
draw.rectangle(bbox, outline=color, width = width)
draw.text(text_pos, 'Ground Truth',color,font=font) # font 설정
img.show()
Troubleshooting
jpeg not found
- "ValueError: --enable-jpeg requested but jpeg not found" occurred after the upgrade to Pillow=3.0.0 #1457
- RFC: Require libjpeg and zlib by default #1412
Installation may fail with an error saying that jpeg cannot be found, as shown below.
In this case, you can add the --disable-jpeg flag to remove jpeg support.
See also
- Python
-
Python Imaging Library (PIL) - Numpy
- scikit-image
- SimpleITK - multi-dimensional image analysis
Favorite site
Pages that link here