Comments (5)
Possibly caused by non-Unicode characters in font path
- python-pillow/Pillow#3480
- python-pillow/Pillow#3785
- python-pillow/Pillow#3145
- pil-issue-oserror-cannot-open-resource
from xrit-rx.
Same issue after updating to Pillow 7.0.0
from xrit-rx.
Added try/catch and warning for missing fonts in 92df164
from xrit-rx.
I have the same issue when using Windows 10
with Japanese
and trying to open the font ARIAL.TTF
I'm using version 7.0.0
and handle dependencies with Poetry
Traceback (most recent call last):
File "render_annotations.py", line 240, in <module>
main(file_path)
File "render_annotations.py", line 216, in main
write_image_with_annotations(image_annotations, url, item["key"])
File "render_annotations.py", line 182, in write_image_with_annotations
newly_drawn_text_box = draw_annotation_to_image(annotation, image, drawn_text_boxes)
File "render_annotations.py", line 154, in draw_annotation_to_image
return draw_text(annotation, image, drawn_text_boxes)
File "render_annotations.py", line 112, in draw_text
fnt = ImageFont.truetype("ARIAL.TTF", ANNOTATION_FONT_SIZE)
File "C:\Users\Man\AppData\Local\pypoetry\Cache\virtualenvs\qa-show-all-annotations-gvzPHQ0M-py3.7\lib\site-packages\PIL\ImageFont.py", line 642, in truetype
return freetype(font)
File "C:\Users\Man\AppData\Local\pypoetry\Cache\virtualenvs\qa-show-all-annotations-gvzPHQ0M-py3.7\lib\site-packages\PIL\ImageFont.py", line 639, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "C:\Users\Man\AppData\Local\pypoetry\Cache\virtualenvs\qa-show-all-annotations-gvzPHQ0M-py3.7\lib\site-packages\PIL\ImageFont.py", line 188, in __init__
font, size, index, encoding, layout_engine=layout_engine
OSError: cannot open resource
PS C:\Users\Man\Documents\GitHub\crowd-ops\Projects\Add-Annotations>
I was able to find a work-around copying the file to the same folder as the script and then changing:
fnt = ImageFont.truetype("ARIAL.TTF", ANNOTATION_FONT_SIZE)
to
fnt = ImageFont.truetype("./ARIAL.TTF", ANNOTATION_FONT_SIZE)
from xrit-rx.
Ok interesting, this seems to be a bit tedious to get going cross-platform. I'll investigate.
from xrit-rx.
Related Issues (13)
- HRIT Decoding (J2K and missing CPPDUs) HOT 34
- DVB Discussion HOT 19
- Automatically generate images HOT 1
- Thank you for the hard work :) HOT 42
- CE-SAT-1 support
- OSError: invalid argument for chinese fonts name
- Elektro-L3 support
- xrit-rx stops working after a while
- VCDU continuity counter HOT 1
- Mystery ADD file HOT 11
- VCID filtering HOT 1
- Unexpected keyword argument 'width' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xrit-rx.