Browse Source

added zipscale module which inhiterances from zipprocessor module

master
T. Meissner 10 years ago
parent
commit
c25b1b4991
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      python_3_oop/chapter05/zipscale.py

+ 18
- 0
python_3_oop/chapter05/zipscale.py View File

@ -0,0 +1,18 @@
from zipprocessor import ZipProcessor
import sys
import os
from pygame import image
from pygame.transform import scale
class ZipScale(ZipProcessor):
def process_files(self):
'''Scale each image in the directory to 640x480'''
for filename in os.listdir(self.temp_directory):
im = image.load(self._full_filename(filename))
scaled = scale(im, (640, 480))
image.save(scaled, self._full_filename(filename))
if __name__ == "__main__":
ZipScale(*sys.argv[1:2]).process_zip()

Loading…
Cancel
Save