@@ -139,6 +139,8 @@ def print_label(self, **kwargs):
139
139
if label_specs .identifier == media_type :
140
140
media_specs = label_specs
141
141
142
+ rotation = int (self .get_setting ('ROTATION' ))
143
+
142
144
try :
143
145
# Resize image if media type is a die cut label (the brother_ql library only accepts images
144
146
# with a specific size in that case)
@@ -147,6 +149,17 @@ def print_label(self, **kwargs):
147
149
if media_specs .form_factor in [FormFactor .DIE_CUT , FormFactor .ROUND_DIE_CUT ]:
148
150
# Scale image to fit the entire printable area and pad with whitespace (while preserving aspect ratio)
149
151
printable_image = ImageOps .pad (label_image , media_specs .dots_printable , color = "white" )
152
+
153
+ if rotation == 90 :
154
+ # Rotate image 90 degrees
155
+ printable_image = printable_image .rotate (90 , expand = True )
156
+ elif rotation == 180 :
157
+ # Rotate image 180 degrees
158
+ printable_image = printable_image .rotate (180 , expand = True )
159
+ elif rotation == 270 :
160
+ # Rotate image 270 degrees
161
+ printable_image = printable_image .rotate (270 , expand = True )
162
+
150
163
else :
151
164
# Just leave image as-is
152
165
printable_image = label_image
@@ -169,7 +182,7 @@ def print_label(self, **kwargs):
169
182
'images' : [printable_image ],
170
183
'label' : media_type ,
171
184
'cut' : self .get_setting ('AUTO_CUT' ),
172
- 'rotate' : self . get_setting ( 'ROTATION' ) ,
185
+ 'rotate' : rotation ,
173
186
'compress' : self .get_setting ('COMPRESSION' ),
174
187
'hq' : self .get_setting ('HQ' ),
175
188
'red' : red ,
0 commit comments