Machinery for building and testing Python Wheels for Linux, OSX and (less flexibly) Windows.
Advanced Custom Fields
Original Apollo 11 guidance computer (AGC) source code.
🍺 The missing package manager for macOS (or Linux)
Find and copy needed dynamic libraries into python wheels
Docker images for ci testing
🍻 Default formulae for the missing package manager for macOS
A library for complex text layout
libraqm using cmake
issue commentpython-pillow/Pillow
Here is an standard example with the log. This example runs fine on my older Mac but asbyou can see not on my M1 MacBook Air. I'm using the same versions of everything on both machines. I had to add a path to .zprofile on the M1 Mac to get this far.
from PIL import Image #Open image using Image module im = Image.open("images/cuba.jpg") #Show actual Image im.show() #Show rotated Image im = im.rotate(45) im.show()
================================================================================ May 8, 2021 at 7:02:43 PM ~/Library/Mobile Documents/iCloud~com~barebones~bbedit/Documents/pillowTest.py
Traceback (most recent call last): File "/Users/frankwattenberg/Library/Mobile Documents/iCloud~com~barebones~bbedit/Documents/pillowTest.py", line 1, in <module> from PIL import Image File "/Users/frankwattenberg/Library/Python/3.9/lib/python/site-packages/PIL/Image.py", line 109, in <module> from . import _imaging as core ImportError: dlopen(/Users/frankwattenberg/Library/Python/3.9/lib/python/site-packages/PIL/_imaging.cpython-39-darwin.so, 2): no suitable image found. Did find: /Users/frankwattenberg/Library/Python/3.9/lib/python/site-packages/PIL/_imaging.cpython-39-darwin.so: mach-o, but wrong architecture /Users/frankwattenberg/Library/Python/3.9/lib/python/site-packages/PIL/_imaging.cpython-39-darwin.so: mach-o, but wrong architecture
comment created time in an hour
issue commentpython-pillow/Pillow
Hi. Thanks for your help.
I'm using Python 3.9.5 on two different Macs. One is an older Mac and everything is working fine. The other is an M1 MacBook Air and that is the one where I'm having difficulties. I've done some more investigating and the problem seems to be with "secondary" or indirect imports if that makes sense. It looks like Python finds the modules I installed but then when those modules try to import things that are there it doesn't find them. I'm not sure that makes sense. I had a lot of trouble figuring out what to change ands eventually added a path to .zprofile.
Thanks again for any help you can give me.
Frank
comment created time in 2 hours
issue commentpython-pillow/Pillow
More info. Sorry this is the first time I've used this reporting facility.
I'm using the latest versions of Pillow and Python. MacOS Big Sur 11.3.1
I've been struggling with this problem for days and have tried multiple things - reloading the latest versions of Python and Pillow and pip and editing the .zprofile file to make sure Python was including the libraries. I thought the problem was likely a path problem.
Eventually I noticed that the error report mentioned line 109 of Image.py and looked at that line.
Is it possible there was an error in the pkg for the new M1 Macs?
I'm a Python newbie but have some Uinx experience. I could easily be missing something basic.
Thanks for looking at this.
comment created time in 6 hours
issue openedpython-pillow/Pillow
<!-- Thank you for reporting an issue.
Follow these guidelines to ensure your issue is handled properly.
If you have a ...
-
General question: consider asking the question on Stack Overflow with the python-imaging-library tag:
- https://stackoverflow.com/questions/tagged/python-imaging-library
Do not ask a question in both places.
If you think you have found a bug or have an unexplained exception then file a bug report here.
-
Bug report: include a self-contained, copy-pastable example that generates the issue if possible. Be concise with code posted. Guidelines on how to provide a good bug report:
- https://stackoverflow.com/help/mcve
Bug reports which follow these guidelines are easier to diagnose, and are often handled much more quickly.
-
Feature request: do a quick search of existing issues to make sure this has not been asked before.
We know asking good questions takes effort, and we appreciate your time. Thank you. -->
What did you do?
What did you expect to happen?
What actually happened?
What are your OS, Python and Pillow versions?
- OS:
- Python:
- Pillow:
<!-- Please include code that reproduces the issue and whenever possible, an image that demonstrates the issue. Please upload images to GitHub, not to third-party file hosting sites. If necessary, add the image to a zip or tar archive.
The best reproductions are self-contained scripts with minimal dependencies. If you are using a framework such as Plone, Django, or Buildout, try to replicate the issue just using Pillow. -->
code goes here
created time in 6 hours
PR closed python-pillow/Pillow
Fixes inability to write TIFF file with float DPI values. It's crucial to set these settings for industrial printing purposes because they often work on specific DPIs.
pr closed time in 11 hours
pull request commentpython-pillow/Pillow
Fix: Allow TIFF plugin to write DPI values with floating point
Hi. If you had created this pull request two weeks ago, you would have started the ball rolling to help #4129 with this change, and I'd look at this and suggest that we should remove the TIFF rounding on loading as well - however, PR #5446 already removes TIFF DPI rounding on both loading and saving.
Thanks for info, I’ll close this PR then and will just use modified package for the moment
comment created time in 11 hours
Pull request review commentmatthew-brett/multibuild
Fixed hdf5 finding szip and libaec
function build_hdf5 { local short=$(echo $HDF5_VERSION | awk -F "." '{printf "%d.%d", $1, $2}') fetch_unpack $hdf5_url/hdf5-$short/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz (cd hdf5-$HDF5_VERSION \+ && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib \
Should this be $BUILD_PREFIX/lib ?
comment created time in 16 hours
push eventpython-pillow/Pillow
commit sha 3795772187d946107fed953c4ab790bdd16cd8e8
Use python3
commit sha 2a94728c0f342a9a6a44175faee9bbeb573297e4
Merge pull request #5477 from radarhere/python3 Use python3
push time in 19 hours
issue closedpython-pillow/Pillow
getsize() is throwing "{OSError}too many function definitions" for certain fonts
<!-- Thank you for reporting an issue.
Follow these guidelines to ensure your issue is handled properly.
If you have a ...
-
General question: consider asking the question on Stack Overflow with the python-imaging-library tag:
- https://stackoverflow.com/questions/tagged/python-imaging-library
Do not ask a question in both places.
If you think you have found a bug or have an unexplained exception then file a bug report here.
-
Bug report: include a self-contained, copy-pastable example that generates the issue if possible. Be concise with code posted. Guidelines on how to provide a good bug report:
- https://stackoverflow.com/help/mcve
Bug reports which follow these guidelines are easier to diagnose, and are often handled much more quickly.
-
Feature request: do a quick search of existing issues to make sure this has not been asked before.
We know asking good questions takes effort, and we appreciate your time. Thank you. -->
What did you do?
I tried to use a font called Singo and it works to read the font ImageFont.truetype(font="singo.ttf", size=14) but then I'm getting the error {OSError}too many function definitions when I try to get the text size. It is crashing in the function getsize() in the file ImageFont.py
I tried with two different font files, one of them works even though they look identical on my computer and I am able to install both on my computer. For reference, here are the two fonts; https://github.com/norahsakal/test-font-debugging
What did you expect to happen?
I expected to get the height and width from the font.
What actually happened?
The function getsize() in the file ImageFont.py is throwing the error {OSError}too many function definitions
What are your OS, Python and Pillow versions?
- OS: MacOS
- Python: 3.7
- Pillow: 8.2.0
<!-- Please include code that reproduces the issue and whenever possible, an image that demonstrates the issue. Please upload images to GitHub, not to third-party file hosting sites. If necessary, add the image to a zip or tar archive.
The best reproductions are self-contained scripts with minimal dependencies. If you are using a framework such as Plone, Django, or Buildout, try to replicate the issue just using Pillow. -->
Here is what I tried to do
from PIL import Image, ImageDraw
import PIL.ImageFont as ImageFont
draw = ImageDraw.Draw('image.pg')
font_text = ImageFont.truetype("singo.ttf", 13)
text = "Hello"
w, h = draw.textsize(text, font=font_text)
The error
File "/tmp/sls-py-req/PIL/ImageDraw.py", line 569, in textsize
return font.getsize(text, direction, features, language, stroke_width)
File "/tmp/sls-py-req/PIL/ImageFont.py", line 430, in getsize
size, offset = self.font.getsize(text, "L", direction, features, language)
OSError: too many function definitions
closed time in a day
norahsakalissue commentpython-pillow/Pillow
getsize() is throwing "{OSError}too many function definitions" for certain fonts
Thank you so much for your prompt reply @radarhere, I truly appreciate it! Closing this 🙏
comment created time in a day
issue commentpython-pillow/Pillow
There is now a Pillow plugin for HEIF available, pyheif-pillow-opener.
https://pypi.org/project/pyheif-pillow-opener/
comment created time in a day
issue commentpython-pillow/Pillow
Indefinite loop while counting frames in truncated tiff image
Unfortunately I cannot shared this file, it is confidential. As I tried to create another one, I also wasn't able to open it in such a software. That leads me to outcome that n_frames should really raise an exception rather than return an invalid number. It should be sufficient to add raise in here https://github.com/python-pillow/Pillow/blob/master/src/PIL/TiffImagePlugin.py#L794 (this change would cause 2 tests to fail)
comment created time in a day
issue commentpython-pillow/Pillow
Indefinite loop while counting frames in truncated tiff image
Thank you for quick solution. This seems to work when the last frame is corrupted. But when the image contains e.g. 4 frames and the third one is corrupted, n_frames returns 2 which is incorrect.
comment created time in 2 days
PR opened python-pillow/Pillow
Fixes inability to write TIFF file with float DPI values. It's crucial to set these settings for industrial printing purposes because they often work on specific DPIs.
pr created time in 2 days
issue openedpython-pillow/Pillow
Indefinite loop while counting frames in truncated tiff image
<!-- Thank you for reporting an issue.
Follow these guidelines to ensure your issue is handled properly.
If you have a ...
-
General question: consider asking the question on Stack Overflow with the python-imaging-library tag:
- https://stackoverflow.com/questions/tagged/python-imaging-library
Do not ask a question in both places.
If you think you have found a bug or have an unexplained exception then file a bug report here.
-
Bug report: include a self-contained, copy-pastable example that generates the issue if possible. Be concise with code posted. Guidelines on how to provide a good bug report:
- https://stackoverflow.com/help/mcve
Bug reports which follow these guidelines are easier to diagnose, and are often handled much more quickly.
-
Feature request: do a quick search of existing issues to make sure this has not been asked before.
We know asking good questions takes effort, and we appreciate your time. Thank you. -->
What did you do?
I tried to count number of frames in a tiff image. However, the image is corrupted.
What did you expect to happen?
I expected some kind of exception (OSError).
What actually happened?
Warning is logged
.../lib/python3.9/site-packages/PIL/TiffImagePlugin.py:793: UserWarning: Truncated File Read
and code is trapped inside indefinite for loop.
What are your OS, Python and Pillow versions?
- OS: MacOS Big Sur
- Python: 3.9.4
- Pillow: 8.2.0
also occurs in docker container with
- OS: Ubuntu focal
- Python: 3.9.0
- Pillow: 8.2.0
<!-- Please include code that reproduces the issue and whenever possible, an image that demonstrates the issue. Please upload images to GitHub, not to third-party file hosting sites. If necessary, add the image to a zip or tar archive.
The best reproductions are self-contained scripts with minimal dependencies. If you are using a framework such as Plone, Django, or Buildout, try to replicate the issue just using Pillow. -->
from pathlib import Path
from PIL import Image
# path to the attached image
file_path = Path("truncated_img.tiff")
Image.open(file_path).n_frames
created time in 2 days
pull request commentpython-pillow/Pillow
There were 2 cves assigned for 2 fuzzier test cases that looked very similar before I got to fixing it. Once the fix was done, there was one bug that could hit any multiband mode but the fuzzier only found these two.
comment created time in 2 days
issue commentpython-pillow/Pillow
RPATH error when including 8.2.0 in a RPM build
@radarhere using the no-binary switch thus far seems to have worked well for us. Thank you very much for your help.
comment created time in 2 days
issue commentpython-pillow/Pillow
Possible Get Pixel Memory Leak
I used tracemalloc and you can see its output in the first image.
comment created time in 2 days
issue commentpython-pillow/Pillow
Since 6.0, setting float resolution with `dpi` argument converts to an integer
Thanks for the info. If it's PPM in integer in specification, yeah that explains why it's decimal in PPC (per centimeter) (and DPI).
After another thought, I think maybe @radarhere meant that PIL/pillow never could have float DPI for BMP/PNG even before v6. So if will simply want to restore the previous behavior, it's absolutely fair to only reverting on TIF/WMF. Just feel like this is a good chance to improve on it since the specification of the PNG/BMP does allow float DPI (extra work, I know).
comment created time in 2 days
issue commentpython-pillow/Pillow
Since 6.0, setting float resolution with `dpi` argument converts to an integer
I believe he is referring to the data type in the file header(s). PNG & BMP spec specify their resolution in pixels per meter, so as an integer. Divided into a DPI would likely give a floating point.
Tiff expects a rational number (not really floating point), see the tiff spec on XResolution.
We do work with printing/platemaking software which absolutely requires a rational dpi (4064,5) and not (812.79999..545..), and also 1BPP encoding. I've now manually written simple TIFF encoders in multiple languages because of this. Its really a simple format when you don't have to be as flexible as PIL or libtiff.
comment created time in 2 days
issue commentpython-pillow/Pillow
Since 6.0, setting float resolution with `dpi` argument converts to an integer
Do you mean you can't save PNG/BMP with float DPI with pillow or in general?
If you look at the original ticket #3323, that test image (which is generated with my sanner) does have a float DPI and it's pretty common for all the scanners I have used (Epson, Canon, etc.).
comment created time in 2 days
issue commentpython-pillow/Pillow
from PIL import Image causing _imaging.cpython-38-x86_64-linux-gnu.so: __strdup: symbol not found
@radarhere - we are currently using python:3.8.3-slim-buster instead of alpine. If its not reproducible, please close this issue. Thanks for looking into this issue.
comment created time in 2 days
pull request commentpython-pillow/Pillow
One each for:
-
CVE-2021-25287: "There is an out-of-bounds read in J2kDecode, in j2ku_graya_la."
-
CVE-2021-25288: "There is an out-of-bounds read in J2kDecode, in j2ku_gray_i."
The CVEs from https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#security at MITRE (example) are still showing as reserved:
** RESERVED ** This candidate has been reserved by an organization or individual that will use it when announcing a new security problem. When the candidate has been publicized, the details for this candidate will be provided.
Does we or Tidelift need to do anything to publicise them?
comment created time in 2 days
pull request commentpython-pillow/Pillow
Why are there 2 CVEs assigned for "Fix OOB read in Jpeg2KDecode?" Could someone please explain?
comment created time in 2 days
pull request commentpython-pillow/Pillow
Hi, the CVEs mentioned in commits and release notes will be reported to Mitre? Thanks.
comment created time in 2 days
issue commentpython-pillow/Pillow
from PIL import Image causing _imaging.cpython-38-x86_64-linux-gnu.so: __strdup: symbol not found
There is an ongoing effort to add support for musl based wheels to Python, but it's not fully implemented yet: https://discuss.python.org/t/wheels-for-musl-alpine/7084/56
With python3.9-alpine I have to add gcc musl-dev zlib-dev jpeg-dev (and run pip install --force pillow) in the final container. This doubles the size of my images. Is there really no other option?
You should be able to remove those extra packages after installing Pillow and keep only the non-dev versions (zlib, jpeg). With other platforms you would be able to build a wheel and copy only that, but as mentioned above, this is not ready yet for musl based distributions such as Alpine.
comment created time in 2 days
issue openedpython-pillow/Pillow
getsize() is throwing the error "{OSError}too many function definitions" for certain fonts
<!-- Thank you for reporting an issue.
Follow these guidelines to ensure your issue is handled properly.
If you have a ...
-
General question: consider asking the question on Stack Overflow with the python-imaging-library tag:
- https://stackoverflow.com/questions/tagged/python-imaging-library
Do not ask a question in both places.
If you think you have found a bug or have an unexplained exception then file a bug report here.
-
Bug report: include a self-contained, copy-pastable example that generates the issue if possible. Be concise with code posted. Guidelines on how to provide a good bug report:
- https://stackoverflow.com/help/mcve
Bug reports which follow these guidelines are easier to diagnose, and are often handled much more quickly.
-
Feature request: do a quick search of existing issues to make sure this has not been asked before.
We know asking good questions takes effort, and we appreciate your time. Thank you. -->
What did you do?
I tried to use a font called Singo (https://www.cufonfonts.com/font/singo-2) and it works to read the font ImageFont.truetype(font="singo.ttf", size=14) but then I'm getting the error {OSError}too many function definitions when I try to get the text size. It is crashing in the function getsize() in the file ImageFont.py
What did you expect to happen?
I expected to get the height and width from the font.
What actually happened?
The function getsize() in the file ImageFont.py is throwing the error {OSError}too many function definitions
What are your OS, Python and Pillow versions?
- OS: MacOS
- Python: 3.7
- Pillow: 8.2.0
<!-- Please include code that reproduces the issue and whenever possible, an image that demonstrates the issue. Please upload images to GitHub, not to third-party file hosting sites. If necessary, add the image to a zip or tar archive.
The best reproductions are self-contained scripts with minimal dependencies. If you are using a framework such as Plone, Django, or Buildout, try to replicate the issue just using Pillow. -->
Here is what I tried to do
from PIL import Image, ImageDraw
import PIL.ImageFont as ImageFont
draw = ImageDraw.Draw('image.pg')
font_text = ImageFont.truetype("singo.ttf", 13)
text = "Hello"
w, h = draw.textsize(text, font=font_text)
created time in 3 days
issue commentpython-pillow/Pillow
Possible Get Pixel Memory Leak
I just reopened this issue as I noticed once making the image into a NumPy array the leak went away. Something strange is going on here.
comment created time in 3 days