-
Notifications
You must be signed in to change notification settings - Fork 75
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
Python PIL OSError: invalid pixel size #142
Comments
I think that's an error from freetype - and it is what it says, invalid pixel size. Some bitmap color fonts (sbix and CBDT) contains bitmaps designed for specific sizes, and if you ask for pixel sizes not in one of the designed values, FreeType gives you that error. You can use "ftdump" to get a list of what valid sizes are. |
How is this error related to this font? |
From that error message, I would assume that PIL's I thought I have written a README.md about it, but perhaps I have only written to freetype-devel: if you have either pycairo or skia-python available, you can make any freetype-py using program (and I believe PIL being one) support SVG-OT with either https://github.com/HinTak/harfbuzz-python-demos/blob/master/otsvg.py or https://github.com/HinTak/harfbuzz-python-demos/blob/master/skia_ot_svg_module.py . These two basically enable any freetype-py using python programs to read SVG-OT fonts. And SVG-OT being any-pixel-size, it gets around the sbix/CBDT fixed-pixel-size limitations. You might have to ask PIL people how to hook the two modules in - it depends on how PIL uses freetype-py/freetype. |
Okay, I looked at PIL in my hard disk - it uses freetype directly via |
font = ImageFont.truetype(font_path, font_size)
no size gives me no "OSError: invalid pixel size"
python PIL
The text was updated successfully, but these errors were encountered: