Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88f7164

Browse files
authored
Add files via upload
1 parent 83ffdd1 commit 88f7164

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import PIL
2+
import os
3+
import os.path
4+
from PIL import Image
5+
6+
img_dir = r'C:/MyDocuments/roytuts/feature-images/temp/'
7+
8+
print('Bulk images resizing started...')
9+
10+
for img in os.listdir(img_dir):
11+
f_img = img_dir + img
12+
f, e = os.path.splitext(img_dir + img)
13+
img = Image.open(f_img)
14+
img = img.resize((1200, 628))
15+
#img.save(f + '_resized.jpg')
16+
img.save(f_img)
17+
18+
print('Bulk images resizing finished...')
19+
20+
#from PIL import Image
21+
#import os, sys
22+
23+
#img_dir = "C:/MyDocuments/roytuts/feature-images/resized-2/"
24+
#dirs = os.listdir( img_dir )
25+
26+
#def resize_bulk_images():
27+
# for img in dirs:
28+
# if os.path.isfile(img_dir + img):
29+
# im = Image.open(img_dir + img)
30+
# f, e = os.path.splitext(img_dir + img)
31+
# imResize = im.resize((1200, 628), Image.ANTIALIAS)
32+
# imResize.save(f + '_resized.jpg', 'JPEG', quality=90)
33+
34+
#print('Bulk images resizing started...')
35+
#resize_bulk_images()
36+
#print('Bulk images resizing finished...')

python-bulk-images-resize/readme.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You can go through the tutorial https://www.roytuts.com/how-to-resize-bulk-images-using-python/

0 commit comments

Comments
 (0)