Skip to content

Commit

Permalink
Merge branch 'bugfix/antialias'
Browse files Browse the repository at this point in the history
  • Loading branch information
GjjvdBurg committed Oct 1, 2023
2 parents 9f3af5f + 303bbe4 commit d5918e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Expand Up @@ -16,14 +16,27 @@ 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 }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}

- 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

Expand Down
6 changes: 4 additions & 2 deletions hugophotoswipe/photo.py
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d5918e1

Please sign in to comment.