Closed iprotsyuk closed 3 years ago
This is a bug with I;16 images, like #3747
I've created PR #5598 to resolve this.
btw when looking for a workaround for this issue, I tried to pre-render the text as a PNG and use Image.paste()
later on to effectively get the same output. However, Image.paste()
also squeezes the overlay image when the parent is I;16
. I wonder if more fundamental solution exists for these cases, instead of patching every method to make it aware of I;16
pixels?
What did you do?
I tried to render a line of text on a 16-bit grayscale image using a TrueType font and the
ImageDraw
module.What did you expect to happen?
I expected the shape of characters to be determined only by the actual font file and size, both of which I specified when initializing an instance of
ImageFont.FreeTypeFont
.What actually happened?
For some reason the characters appear very skinny compared to the same line of text being rendered with the same font over an RGB image of the same size.
What are your OS, Python and Pillow versions?
Grayscale image:
RGB image:
ProductSans-Regular-prehint.ttf (to test locally, change ".gif" extension of this file to ".ttf" as GitHub doesn't allow to upload those directly)