Advertisement
sreejith2904

image_compressor.py

May 11th, 2011
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import os
  2. from PIL import Image
  3. n = 1
  4. a  = os.listdir("/home/chip/comp")
  5. for i in a:
  6.     if i != 'compress.py':
  7.         img = Image.open(i)
  8.         x = img.size[0]
  9.         y = img.size[1]
  10.        
  11.         compress = img.resize((x,y),Image.BILINEAR)
  12.         compress.save(str(n) + '.jpg')
  13.         n+=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement