Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the use of PIL.Image.ANTIALIAS #42

Merged
merged 8 commits into from Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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