Skip to content

Commit 1ffb1b8

Browse files
committed
first commit
0 parents  commit 1ffb1b8

File tree

558 files changed

+128858
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

558 files changed

+128858
-0
lines changed

.idea/imagecrop.iml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 282 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from PIL import Image, ImageOps, ImageDraw
2+
import os
3+
4+
images = []
5+
num = 1
6+
7+
for file in os.listdir('input/'):
8+
if file[-3:] == ('jpg' or 'png' or 'peg'):
9+
images.append(file)
10+
print(file)
11+
print(images)
12+
for name in images:
13+
img = Image.open('input/'+name)
14+
15+
basewidth = 512
16+
wpercent = (basewidth / float(img.size[0]))
17+
hsize = int((float(img.size[1]) * float(wpercent)))
18+
img = img.resize((basewidth, hsize), Image.ANTIALIAS)
19+
20+
bigsize = (img.size[0] * 3, img.size[1] * 3)
21+
mask = Image.new('L', bigsize, 0)
22+
draw = ImageDraw.Draw(mask)
23+
draw.ellipse((0, 0) + bigsize, fill=255)
24+
mask = mask.resize(img.size, Image.ANTIALIAS)
25+
img.putalpha(mask)
26+
27+
output = ImageOps.fit(img, mask.size, centering=(0.5, 0.5))
28+
output.putalpha(mask)
29+
output.save('output/{}.png'.format(num))
30+
num += 1
31+
print(num, ' is done.')

0 commit comments

Comments
 (0)