Skip to content

Commit 73298ff

Browse files
author
nadermx
committed
Shim Image.ANTIALIAS for Pillow>=10 (fixes moviepy 1.x video resize)
moviepy 1.x's resize fx references Image.ANTIALIAS, removed in Pillow 10, so video frame iteration crashed with AttributeError. Alias it to LANCZOS when missing. Bump to 0.4.3.
1 parent b16fdec commit 73298ff

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

backgroundremover/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
A library to remove background from videos and images
55
"""
66

7-
__version__ = "0.4.2"
7+
__version__ = "0.4.3"
88
__author__ = 'Johnathan Nader'
99
__credits__ = 'BackgroundRemoverAI.com'

backgroundremover/bg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import os
33
import typing
44
from PIL import Image, ImageOps
5+
# Pillow>=10 removed Image.ANTIALIAS; moviepy 1.x still references it during resize.
6+
if not hasattr(Image, "ANTIALIAS"):
7+
Image.ANTIALIAS = getattr(getattr(Image, "Resampling", Image), "LANCZOS")
58
from pymatting.alpha.estimate_alpha_cf import estimate_alpha_cf
69
from pymatting.foreground.estimate_foreground_ml import estimate_foreground_ml
710
from pymatting.util.util import stack_images

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
setup(
1313
name="backgroundremover",
14-
version="0.4.2",
14+
version="0.4.3",
1515
description="Background remover from image and video using AI",
1616
long_description=long_description,
1717
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)