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.

19 lines
574 B

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