Skip to content

Instantly share code, notes, and snippets.

@yongjun823
Created August 19, 2017 09:04
Show Gist options
  • Select an option

  • Save yongjun823/5cb0d295961d0729b0585a0de7ab1f70 to your computer and use it in GitHub Desktop.

Select an option

Save yongjun823/5cb0d295961d0729b0585a0de7ab1f70 to your computer and use it in GitHub Desktop.
PIL : image resize & draw rectangle
from PIL import Image, ImageDraw
im = Image.open(img_path + filter_files[0]) # path
im = im.resize((img_y_size, img_x_size), 1)
draw = ImageDraw.Draw(im)
draw.rectangle(((0, 0), (100, 100)), outline='red')
im.save('result.jpg', 'JPEG')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment