1from PIL import Image
2from resizeimage import resizeimage
3
4fd_img = open('test-image.jpeg', 'r')
5img = Image.open(fd_img)
6img = resizeimage.resize_cover(img, [200, 100])
7img.save('test-image-cover.jpeg', img.format)
8fd_img.close()
9
1from PIL import Image
2
3from resizeimage import resizeimage
4
5
6with open('test-image.jpeg', 'r+b') as f:
7 with Image.open(f) as image:
8 cover = resizeimage.resize_cover(image, [200, 100])
9 cover.save('test-image-cover.jpeg', image.format)
10
1from PIL import Image
2
3from resizeimage import resizeimage
4
5with open('test-image.jpeg', 'r+b')
6 with Image.open() as image:
7 is_valid = resizeimage.resize_cover.validate(image, [200, 100])
8
9# do something else...
10
11if is_valid:
12 with Image.open('test-image.jpeg') as image:
13 resizeimage.resize_cover.validate(image, [200, 100], validate=False)
14 cover = resizeimage.resize_cover(image, [200, 100])
15 cover.save('test-image-cover.jpeg', image.format)
16