TextRecognitionDataGenerator icon indicating copy to clipboard operation
TextRecognitionDataGenerator copied to clipboard

Text generation does not support new line

Open harnit-bakshi opened this issue 5 years ago • 2 comments

When generating text from strings I noticed the newlines are not preserved within the image Within the _computer_text_generator.py, _generate_horizontal_text method I see the following loop: for i, c in enumerate(text): txt_draw.text( (sum(char_widths[0:i]) + i * character_spacing, 0), c, fill=fill, font=image_font, )

Seems like the y axis is 0?

I am happy to do a pull request for this if you are ok. Also do you see any issues for doing this?

harnit-bakshi avatar Dec 01 '19 01:12 harnit-bakshi

TRDG in its current state only does single lines of text. I do agree that this could change, but there would probably be a greater impact across the codebase.

Feel free to try your hand at it, I would accept a PR for it, but expect me to be a little more picky when reviewing due to the importance of the feature.

Otherwise, I expect to do it myself before the end of 2019.

Belval avatar Dec 01 '19 03:12 Belval

Hi thank you so much for this really useful library as well as for your prompt response, I have changed it for my use case locally. If I can manage to get it work for all use cases I will send a pull request. Thanks

harnit-bakshi avatar Dec 02 '19 10:12 harnit-bakshi