diff --git a/graphics/text/Makefile b/graphics/text/Makefile index a9727b28..262ba020 100644 --- a/graphics/text/Makefile +++ b/graphics/text/Makefile @@ -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: diff --git a/graphics/text/rotate.py b/graphics/text/rotate.py index 0eb8996b..deb80874 100644 --- a/graphics/text/rotate.py +++ b/graphics/text/rotate.py @@ -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])