Skip to content
Search

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

Installation may fail with an error saying that jpeg cannot be found, as shown below.

ValueError: --enable-jpeg requested but jpeg not found, aborting.

In this case, you can add the --disable-jpeg flag to remove jpeg support.

$ python setup.py build_ext --disable-jpeg install

See also

Favorite site

author Zer0 sitemap