Skip to content

Commit

Permalink
Fix pklaus#152 ANTIALIAS issue with PIL
Browse files Browse the repository at this point in the history
Version check is added for compatibility.
Fix pklaus#152
  • Loading branch information
ONLYA authored Apr 16, 2024
1 parent 56cf439 commit a2a877b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion brother_ql/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging

from PIL import Image
from PIL import __version__ as PIL_version
import PIL.ImageOps, PIL.ImageChops

from brother_ql.raster import BrotherQLRaster
Expand Down Expand Up @@ -110,7 +111,7 @@ def convert(qlr, images, label, **kwargs):
im = im.resize((im.size[0]//2, im.size[1]))
if im.size[0] != dots_printable[0]:
hsize = int((dots_printable[0] / im.size[0]) * im.size[1])
im = im.resize((dots_printable[0], hsize), Image.ANTIALIAS)
im = im.resize((dots_printable[0], hsize), Image.ANTIALIAS if int(PIL_version.split('.')[0]) < 10 else Image.LANCZOS)
logger.warning('Need to resize the image...')
if im.size[0] < device_pixel_width:
new_im = Image.new(im.mode, (device_pixel_width, im.size[1]), (255,)*len(im.mode))
Expand Down

0 comments on commit a2a877b

Please sign in to comment.