-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite Add Text node #181
Comments
Hello, @Correct-Syntax . |
Hi, @Yashupadhyay603. Sure I'll assign you. If you have any questions feel free to ask. |
@Correct-Syntax ,Thank you very much. |
Hello @Correct-Syntax, I have seen the code to be changed . |
Yeah, that would be a problem. OpenCV only has only a handful of fonts it can use, while OpenImageIO could use most any font (ref). Text rendering via glsl/opengl is a complex topic, so I'm not even sure if you want to look into that. I briefly looked into it (in case we want to go this route) and here's what I came up with:
There's also the Pillow library, but it has it's own set of problems.
@iwoithe, any ideas? |
We removed Pillow as a dependency a while back. I'd suggest to keep it this way if we can.
Not sure how this translates to Python, but using custom fonts seems possible. https://docs.opencv.org/4.1.1/d9/dfa/classcv_1_1freetype_1_1FreeType2.html
I was also going to suggest GLSL until I looked into it. 🙄 The only other thing I can think of that you haven't suggested is using freetype-py. Not sure if it has all the features we currently have or if this will work at all with ModernGL/Numpy. So, the order of my preference:
I will state that I would rather not use Pillow for the reasons @Correct-Syntax suggested (i.e. loss of 16-bit editing and another dependency). Also still not sure about freetype-py, so if OpenCV doesn't work out, I will let @Correct-Syntax decide whether to look into freetype-py or remain using OpenImageIO. Hopefully there's something in this that helps. 🙂 |
Thanks for the additional thoughts, @iwoithe Looking at freetype-py, that actually seems like it could work. I should say that I don't see using Pillow or sticking with OpenImageIO as options. Ideally, we want to do as many of the image processing nodes on the gpu side of things using opengl/glsl as much as possible. This gives us the freedom to edit in high quality and, in theory, it will be faster. Plus, it's easier to translate opengl calls/glsl to anything we may do in the future (I think). So, my preference would be freetype-py + opengl/glsl if that works. I think the real question is, @Yashupadhyay603 how comfortable are you with tackling this either using opencv or via freetype-py and opengl? Do you have experience with opengl/glsl? Either of those would be acceptable for re-implementing this node, so whichever one works and you are comfortable using would be great. For the opencv way, this: https://stackoverflow.com/a/57502572/12787591 may point in the right direction. I'm beginning to realize that the scope of this issue could be pretty big, so if you'd just rather not do it that is okay. But, if you're up for the challenge then I'll do my best to assist as time permits. |
Thank you very much, @Correct-Syntax and @iwoithe for such good suggestions. I will look over both of the ways and see which one would require least changes without loosing any functionality. |
@Correct-Syntax , @iwoithe . So to import multiple font data we have to add their respective .ttf file in the project and then we can use custom fonts using OpenCV. What are your suggestions regarding this ? |
We want to access the system |
In an effort to remove our hard dependence on OpenImageIO which is difficult to install properly, this issue should rewrite the Add Text node (https://github.com/GimelStudio/GimelStudio/blob/master/src/nodes/corenodes/draw/add_text_node.py) using another library (numpy, opencv) or glsl.
The text was updated successfully, but these errors were encountered: