From c25b1b499124e66aac9878e475a0b56750ed329d Mon Sep 17 00:00:00 2001 From: tmeissner Date: Thu, 25 Sep 2014 19:24:47 +0200 Subject: [PATCH] added zipscale module which inhiterances from zipprocessor module --- python_3_oop/chapter05/zipscale.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 python_3_oop/chapter05/zipscale.py diff --git a/python_3_oop/chapter05/zipscale.py b/python_3_oop/chapter05/zipscale.py new file mode 100644 index 0000000..3887406 --- /dev/null +++ b/python_3_oop/chapter05/zipscale.py @@ -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() \ No newline at end of file