I need to fit user's uploaded image to 1000px and put a watermark. Also I need to create thumbnail (without watermark).
class Watermark(object):
def process(self, img):
draw = ImageDraw.Draw(img)
draw.line((0, 0) + img.size, fill=128)
draw.line((0, img.size[1], img.size[0], 0), fill=128)
return img
class Photo(models.Model):
image = ProcessedImageField(upload_to='photo',
processors=[
ResizeToFit(1000, 1000, upscale=False),
Watermark(),
],
format='JPEG')
thumbnail = ImageSpecField(source='image',
processors=[
ResizeToFill(200, 200),
],
format='JPEG')
The trouble is that the thumbnail is created from the already processed image. How to create a thumbnail from the original image, given that the original image should not be saved?