scritcher/scritcher/image.py

18 lines
512 B
Python

import logging
from PIL import Image
log = logging.getLogger(__name__)
class GlitchImage:
"""A wrapper class around PIL.Image"""
def __init__(self, orig_path, target_path):
self.original = orig_path
self.path = target_path
def load(self):
"""Load the given image, convert it to BMP, and write it on the
given target path."""
log.info('opening %r into %r', self.original, self.path)
img = Image.open(self.original)
img.save(self.path, 'BMP')