def resize_image(self, raw, base, max_width, max_height): resized, img = resize_to_fit(raw, max_width, max_height) if resized: base, ext = os.path.splitext(base) base = base + '-%dx%d%s' % (max_width, max_height, ext) raw = image_to_data(img, fmt=ext[1:]) return raw, base, resized