From 2aa1271aec57381b2e83f2be311e4ce21818c68f Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Fri, 12 Jan 2024 09:45:20 +0100 Subject: [PATCH] set Image.MAX_IMAGE_PIXELS=None when using img2pdf --- plakativ.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plakativ.py b/plakativ.py index a2f0109..91cad95 100755 --- a/plakativ.py +++ b/plakativ.py @@ -25,6 +25,11 @@ import logging have_img2pdf = True 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 except ImportError: have_img2pdf = False @@ -1353,8 +1358,6 @@ class Application(tkinter.Frame): ) # remove alpha channel if remove_alpha: - from PIL import Image - img = Image.open(self.filename).convert("RGBA") background = Image.new("RGBA", img.size, (255, 255, 255)) img = Image.alpha_composite(background, img)