SHARE
TWEET

Untitled

a guest Jul 21st, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os, sys
  2. from PIL import Image
  3.  
  4. h = 256
  5. w = 144
  6. in_dir = "./input_dir/"
  7. out_dir = "./output_dir/"
  8. dirs = os.listdir( in_dir )
  9.  
  10. def resize():
  11.     for item in dirs:
  12.         if os.path.isfile(in_dir+item):
  13.             im = Image.open(in_dir+item)
  14.             f, e = os.path.splitext(in_dir+item)
  15.             imResize = im.resize((w, h), Image.ANTIALIAS)
  16.             print(f)
  17.             imResize.save(out_dir + item, 'jpeg', quality=75)
  18.  
  19. resize()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top