1
0
Fork 0
forked from josch/plakativ

set Image.MAX_IMAGE_PIXELS=None when using img2pdf

This commit is contained in:
Johannes Schauer Marin Rodrigues 2024-01-12 09:45:20 +01:00
parent fab6925674
commit 2aa1271aec
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -25,6 +25,11 @@ import logging
have_img2pdf = True have_img2pdf = True
try: try:
from PIL import Image
# ignore PIL limit because this software is meant to create posters which
# naturally can be very large in size
Image.MAX_IMAGE_PIXELS = None
import img2pdf import img2pdf
except ImportError: except ImportError:
have_img2pdf = False have_img2pdf = False
@ -1353,8 +1358,6 @@ class Application(tkinter.Frame):
) )
# remove alpha channel # remove alpha channel
if remove_alpha: if remove_alpha:
from PIL import Image
img = Image.open(self.filename).convert("RGBA") img = Image.open(self.filename).convert("RGBA")
background = Image.new("RGBA", img.size, (255, 255, 255)) background = Image.new("RGBA", img.size, (255, 255, 255))
img = Image.alpha_composite(background, img) img = Image.alpha_composite(background, img)