We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
I tried to use the following code to chop the image edges, but the getbbox() keeps returning None.
getbbox()
None
I tried 9.5.0 and 8.4.0, it all returns None, but it worked and returned a tuple in older version which I can't tell.
from PIL import Image, ImageChops im1 = Image.open("001-0.png") im = im1.convert(mode="RGBA") im1.close() bg = Image.new(im.mode, im.size, im.getpixel((0, 0))) diff = ImageChops.difference(im, bg) diff = ImageChops.add(diff, diff, 2.0, -100) bbox = diff.getbbox() assert bbox is not None
The text was updated successfully, but these errors were encountered:
Because diff is fully transparent.
diff
https://pillow.readthedocs.io/en/stable/releasenotes/7.1.0.html#if-present-only-use-alpha-channel-for-bounding-box
For images with an alpha channel, only the alpha channel is used when calculating the bounding box.
Sorry, something went wrong.
You may be interested in #4849 / #7123.
Thanks for your help. I will use RGB mode instead now and look forward to the PR being merged.
No branches or pull requests
What did you do?
I tried to use the following code to chop the image edges, but the
getbbox()
keeps returningNone
.What did you expect to happen?
I tried 9.5.0 and 8.4.0, it all returns None, but it worked and returned a tuple in older version which I can't tell.
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: