mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-01 04:25:45 -04:00
rotate: fix rotate
Image.rotate had different behavior under 3.1.x, transpose works on all versions
This commit is contained in:
parent
cac04c1271
commit
7251b14892
2 changed files with 14 additions and 3 deletions
|
@ -134,7 +134,7 @@ wikilrs_horiz.png:
|
|||
0,0 killers
|
||||
|
||||
wikilrs.png: wikilrs_horiz.png
|
||||
python rotate.py wikilrs_horiz.png -90 $@
|
||||
python rotate.py wikilrs_horiz.png 270 $@
|
||||
cp $@ ../
|
||||
|
||||
wivctms.png:
|
||||
|
|
|
@ -9,8 +9,19 @@ import os
|
|||
|
||||
img = Image.open(sys.argv[1])
|
||||
img.load()
|
||||
img2 = img.rotate(int(sys.argv[2]), 0, True)
|
||||
img2.crop()
|
||||
angle = int(sys.argv[2])
|
||||
if angle % 90 == 0:
|
||||
if angle == 90 or angle == -270:
|
||||
method = Image.ROTATE_90
|
||||
elif abs(angle) == 180:
|
||||
method = Image.ROTATE_180
|
||||
else:
|
||||
method = Image.ROTATE_270
|
||||
img2 = img.transpose(method)
|
||||
else:
|
||||
img2 = img.rotate(int(sys.argv[2]), 0, True)
|
||||
img2 = img2.crop()
|
||||
|
||||
if os.path.exists(sys.argv[3]): # delete any previous result file
|
||||
os.remove(sys.argv[3])
|
||||
img2.save(sys.argv[3])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue