From 7ab96c55736f1e985d95687cba5630148070d871 Mon Sep 17 00:00:00 2001 From: rourien <32525257+rourien@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:01:04 -0600 Subject: [PATCH] Add backwards compatibility for Pillow >9.1.0 from 4b127b1 --- kindlecomicconverter/image.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kindlecomicconverter/image.py b/kindlecomicconverter/image.py index e62d8a7..4b36e62 100755 --- a/kindlecomicconverter/image.py +++ b/kindlecomicconverter/image.py @@ -116,6 +116,9 @@ class ComicPageParser: self.color = self.colorCheck() self.fill = self.fillCheck() self.splitCheck() + # backwards compatibility for Pillow >9.1.0 + if not hasattr(Image, 'Resampling'): + Image.Resampling = Image def getImageHistogram(self, image): histogram = image.histogram() @@ -248,6 +251,9 @@ class ComicPage: self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-KCC-B' elif 'S2' in mode: self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-KCC-C' + # backwards compatibility for Pillow >9.1.0 + if not hasattr(Image, 'Resampling'): + Image.Resampling = Image def saveToDir(self): try: @@ -375,6 +381,9 @@ class Cover: self.tomeid = tomeid self.image = Image.open(source) self.process() + # backwards compatibility for Pillow >9.1.0 + if not hasattr(Image, 'Resampling'): + Image.Resampling = Image def process(self): self.image = self.image.convert('RGB')