Text alignment removes text completely
See original GitHub issueExpected Behavior
Text should be aligned to center
Current Behavior
Text is not visible
Failure Information (for bugs)
image.print(font, 100, 100, text)
works as intended, but if i use image.print(font, 100, 100, { text: text, alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER })
the text is not visible on the image. There is no error in the console.
Here is a link to the exact code i’m using: https://pastebin.com/3VDSNLjw
Unedited image: https://imgur.com/SzVAm32 Image after editing without text alignment: https://imgur.com/4aB8SaZ Image after editing with text alignment: https://imgur.com/iTViXxz
Steps to Reproduce
image.print(font, 100, 100, { text: text, alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER })
Context
- Jimp Version: 0.6.0
- Operating System: Ubuntu 18.04 LTS
- Node version: 8.11.4
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
Are you sure this is a bug? This works for me:
Maybe there should be better documentation on the topic. Took me quite some time to figure this out too.
For alignment to work properly you need to specify maxWidth and maxHeigh in your call to print().
https://github.com/oliver-moran/jimp/blob/master/packages/plugin-print/src/index.js#L295
The code is sometimes the source of enlightenment.