Reputation: 105
I wish to expand an image, so I can write something at the black expanded space under the original image, but it doesn't work. I can't expand a black space and add it to the image, neither can write at a specific place
I'm new to the Pillow library, can anyone help?
Upvotes: 0
Views: 1403
Reputation: 7538
You could do something like this:
from PIL import Image
HEIGH_OF_THE_BLACK_AREA = 100
with Image.open('image.jpg') as im:
new_im = Image.new(im.mode, size = (im.size[0], im.size[1] + HEIGH_OF_THE_BLACK_AREA))
new_im.putdata(im.getdata())
new_im.save('out.jpg')
Upvotes: 1