mirror of
https://github.com/sjlongland/tornado-gallery.git
synced 2025-09-13 16:43:16 +10:00
resizer: Implement rotation
Need to work on dimensions.
This commit is contained in:
parent
8c67f262bf
commit
2fd4fa665f
@ -190,12 +190,18 @@ class ResizerPool(object):
|
||||
# We do not, press on!
|
||||
pass
|
||||
|
||||
# Open the image
|
||||
img = Image.open(open(orig_node.abs_path,'rb'))
|
||||
|
||||
# Rotate if asked:
|
||||
if rotation != 0:
|
||||
img = img.rotate(rotation, expand=1)
|
||||
|
||||
# Resize!
|
||||
orig = Image.open(open(orig_node.abs_path,'rb'))
|
||||
resized = orig.resize((width, height), Image.LANCZOS)
|
||||
img = img.resize((width, height), Image.LANCZOS)
|
||||
|
||||
# Write out the new file.
|
||||
resized.save(open(cache_path,'wb'), img_format.pil_fmt)
|
||||
img.save(open(cache_path,'wb'), img_format.pil_fmt)
|
||||
|
||||
# Return to caller
|
||||
log.info('Returning resized result')
|
||||
|
Loading…
Reference in New Issue
Block a user