pyvips icon indicating copy to clipboard operation
pyvips copied to clipboard

create text bug

Open doudouodong opened this issue 2 years ago • 3 comments

import pyvips text = pyvips.Image.text(" The package is on the way. It can be", dpi=600)

spaces disappear

https://github.com/libvips/pyvips/assets/47808515/da2272ee-6285-4065-968a-474dd549b96b)

doudouodong avatar Oct 17 '23 07:10 doudouodong

Sorry, I don't understand, it seems to be working in your PNG. What's the bug?

I see:

$ python3
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvips
>>> text = pyvips.Image.text(" The package is on the way. It can be", dpi=600)
>>> text.write_to_file("x.png")
>>> 

To make:

x

jcupitt avatar Oct 17 '23 09:10 jcupitt

https://github.com/libvips/pyvips/assets/47808515/0f5a0fbd-bfd0-421f-af94-5c1af42b081c

doudouodong avatar Oct 18 '23 08:10 doudouodong

Ah, the leading spaces? Pango removes leading and trailing whitespace, you'll need to find some other way to format your text.

What effect are you trying to achieve?

jcupitt avatar Oct 18 '23 10:10 jcupitt