X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=python%2Flabel.py;h=c154275cb087670af05654712887660fa61fa06e;hb=0e5afb71c4f9ad296d0157d5ecdca0f7665d81f6;hp=41618bb7c9d8e6c19730f0eb3e541749f2804a2c;hpb=7a198c587000c0e3d405707c670798e5eb376f3e;p=ql570.git diff --git a/python/label.py b/python/label.py index 41618bb..c154275 100644 --- a/python/label.py +++ b/python/label.py @@ -3,12 +3,12 @@ from PIL import Image, ImageFont, ImageDraw class label: def __init__(self, length, width=336, landscape=False): assert(width == 336 or width == 720) - self.landscape = False + self.landscape = landscape self.fontfile = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf' self.im = Image.new("1", (width, length), "white") if self.landscape: - self.im.rotate(90) + self.im = self.im.rotate(90) def set_font(self, fontfile): self.fontfile = fontfile @@ -21,6 +21,6 @@ class label: draw.text(pos, text, font=self.font) def save(self, outfile): - if self.landscape: - self.im.rotate(90) + if not self.landscape: + self.im = self.im.rotate(90) self.im.save(outfile, "PNG")