oh-my-ocr / text_renderer

https://oh-my-ocr.github.io/text_renderer/README.html
MIT License
789 stars 161 forks source link

How to keep the background image size? #28

Closed wendaogongyi closed 3 years ago

wendaogongyi commented 3 years ago

The generated image size automatically adapts to characters, but I want to keep the original size of the background. How to keep the background size? How to change the generated image background size?

Sanster commented 3 years ago

Background of generated image is randomly cropped from bg image. You can change image height https://github.com/oh-my-ocr/text_renderer/blob/01375e44d9417ac163d424fbae775c62f57bafd7/text_renderer/config/__init__.py#L146

wendaogongyi commented 3 years ago

Thank you for the reply. But I want to keep the big bg image like these picture. Can I change the size of cropped area? Can I know the cutting coordinates? Inkedbackground_LI Inkedbackground

wendaogongyi commented 3 years ago

https://github.com/oh-my-ocr/text_renderer/blob/01375e44d9417ac163d424fbae775c62f57bafd7/text_renderer/render.py#L205 Now I can change the cropped area, and changing the image height can reluctantly achieve the picture's effect. At present, I have no problems, thank you.