Add imagetools.save_to_bytes.
This commit is contained in:
parent
5695450289
commit
953ebe4951
1 changed files with 7 additions and 0 deletions
|
@ -210,3 +210,10 @@ def rotate_by_exif(image):
|
|||
exif[ORIENTATION_KEY] = 1
|
||||
|
||||
return (image, exif)
|
||||
|
||||
def save_to_bytes(image, *save_args, **save_kwargs):
|
||||
bio = io.BytesIO()
|
||||
image.save(bio, *save_args, **save_kwargs)
|
||||
bio.seek(0)
|
||||
blob = bio.read()
|
||||
return blob
|
||||
|
|
Loading…
Reference in a new issue