Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
538 B

  1. from zipprocessor import ZipProcessorInh
  2. import sys
  3. import os
  4. from pygame import image
  5. from pygame.transform import scale
  6. class ZipScale(ZipProcessorInh):
  7. def process_files(self):
  8. """Scale each image in the directory to 640x480"""
  9. for filename in os.listdir(self.temp_directory):
  10. im = image.load(self._full_filename(filename))
  11. scaled = scale(im, (640, 480))
  12. image.save(scaled, self._full_filename(filename))
  13. if __name__ == "__main__":
  14. ZipScale(*sys.argv[1:2]).process_zip()