From 1ac185aa2b791418b23739149b82d73bfaea5655 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Sun, 17 Sep 2023 10:59:24 +0100 Subject: [PATCH 1/6] fix the use of Image.ANTIALIAS in our package --- hugophotoswipe/photo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hugophotoswipe/photo.py b/hugophotoswipe/photo.py index c0c2f29..db441ae 100644 --- a/hugophotoswipe/photo.py +++ b/hugophotoswipe/photo.py @@ -157,7 +157,9 @@ def create_rescaled(self, mode): ) # resize the image with PIL - nimg = self.original_image.resize((nwidth, nheight), Image.ANTIALIAS) + nimg = self.original_image.resize( + (nwidth, nheight), Image.Resampling.LANCZOS + ) pth = self.large_path if mode == "large" else self.small_path logging.info("[%s] Saving %s image to %s" % (self.name, mode, pth)) @@ -219,7 +221,7 @@ def create_thumb_py(self, mode=None, pth=None): # Do the actual crop nimg = self.original_image.crop(box) nimg.load() - nimg.thumbnail((nwidth, nheight), Image.ANTIALIAS) + nimg.thumbnail((nwidth, nheight), Image.Resampling.LANCZOS) # Create the filename and save the thumbnail logging.info("[%s] Saving SmartCrop.py thumbnail." % self.name) From 0c45e4f5f9f431b4fcb0ba6e6727b9adffbfeead Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Sun, 17 Sep 2023 10:59:24 +0100 Subject: [PATCH 2/6] fix the use of Image.ANTIALIAS in our package --- hugophotoswipe/photo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hugophotoswipe/photo.py b/hugophotoswipe/photo.py index c0c2f29..db441ae 100644 --- a/hugophotoswipe/photo.py +++ b/hugophotoswipe/photo.py @@ -157,7 +157,9 @@ def create_rescaled(self, mode): ) # resize the image with PIL - nimg = self.original_image.resize((nwidth, nheight), Image.ANTIALIAS) + nimg = self.original_image.resize( + (nwidth, nheight), Image.Resampling.LANCZOS + ) pth = self.large_path if mode == "large" else self.small_path logging.info("[%s] Saving %s image to %s" % (self.name, mode, pth)) @@ -219,7 +221,7 @@ def create_thumb_py(self, mode=None, pth=None): # Do the actual crop nimg = self.original_image.crop(box) nimg.load() - nimg.thumbnail((nwidth, nheight), Image.ANTIALIAS) + nimg.thumbnail((nwidth, nheight), Image.Resampling.LANCZOS) # Create the filename and save the thumbnail logging.info("[%s] Saving SmartCrop.py thumbnail." % self.name) From 62aed33bba93fb150a636d1bb9b5924beef5804c Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Sun, 1 Oct 2023 23:01:24 +0100 Subject: [PATCH 3/6] install system dependency for smartcrop.py --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48de6bd..c3cc1f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,10 @@ jobs: with: python-version: ${{ matrix.py }} + - name: Install libgirepository + run: sudo apt-get install libgirepository1.0-dev + if: matrix.os == "ubuntu-latest" + - name: Checkout uses: actions/checkout@v2 From fcadff92fa96ec3cdb6883043e68d80da0e05f4f Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Sun, 1 Oct 2023 23:04:48 +0100 Subject: [PATCH 4/6] fix workflow file --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3cc1f8..bea91d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,8 +25,9 @@ jobs: python-version: ${{ matrix.py }} - name: Install libgirepository - run: sudo apt-get install libgirepository1.0-dev - if: matrix.os == "ubuntu-latest" + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get install libgirepository1.0-dev - name: Checkout uses: actions/checkout@v2 From d352bf760df15e311d33847c0413f98979a87018 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Sun, 1 Oct 2023 23:14:15 +0100 Subject: [PATCH 5/6] Add the dependency for MacOS too --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bea91d2..9f4943f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,11 +24,17 @@ jobs: with: python-version: ${{ matrix.py }} - - name: Install libgirepository + - name: Install PyGObject dependencies (Ubuntu) if: matrix.os == 'ubuntu-latest' run: | sudo apt-get install libgirepository1.0-dev + - name: Install PyGObject dependencies (Ubuntu) + if: matrix.os == 'macos-latest' + run: | + brew update + brew install pygobject3 gtk4 + - name: Checkout uses: actions/checkout@v2 From 303bbe459877d48606f25b3cb586c8c23b4f24f6 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Sun, 1 Oct 2023 23:25:53 +0100 Subject: [PATCH 6/6] disable windows build Can't get it to work and no easy way to install PyGObject dependency --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f4943f..71cbff6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,9 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] + # Windows build is disabled, doesn't work without PyGObject. See: + # https://pygobject.readthedocs.io/en/latest/getting_started.html#windows-logo-windows + os: [ 'ubuntu-latest', 'macos-latest' ] # , 'windows-latest' ] py: [ '3.8', '3.11' ] # minimal and latest steps: - name: Install Python ${{ matrix.py }}