[Answer]-Django increases image size in byte while resizing it

1👍

try with this, may be this method help you.

import StringIO
from PIL import Image

image_field = self.cleaned_data.get('image_field')
image_file = StringIO.StringIO(image_field.read())
image = Image.open(image_file)
w, h0 = image.size

image = image.resize((w/2, h/2), Image.ANTIALIAS)

image_file = StringIO.StringIO()
image.save(image_file, 'JPEG', quality=90)

image_field.file = image_file

Leave a comment