Code Monkey home page Code Monkey logo

Comments (10)

Yashupadhyay603 avatar Yashupadhyay603 commented on June 8, 2024 4

@Correct-Syntax ,Thank you very much.
Will start as soon as possible.

from gimelstudio.

Correct-Syntax avatar Correct-Syntax commented on June 8, 2024 2

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.
For the freetype-py + opengl way, that may involve some research on how to render the text to the opengl texture, etc.

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.

from gimelstudio.

Correct-Syntax avatar Correct-Syntax commented on June 8, 2024 1

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.

  • We basically throw away a lot of data since Pillow only supports 8-bit (a waste since we are aiming for 16-bit editing)
  • It's another dependency

@iwoithe, any ideas?

from gimelstudio.

iwoithe avatar iwoithe commented on June 8, 2024 1

There's also the Pillow library, but it has it's own set of problems.

We removed Pillow as a dependency a while back. I'd suggest to keep it this way if we can.

OpenCV only has only a handful of fonts it can use

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

@iwoithe, any ideas?

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:

  1. OpenCV
  2. freetype-py (?)
  3. Keep using OpenImageIO

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. 🙂

from gimelstudio.

Yashupadhyay603 avatar Yashupadhyay603 commented on June 8, 2024 1

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.

from gimelstudio.

Yashupadhyay603 avatar Yashupadhyay603 commented on June 8, 2024

Hello, @Correct-Syntax .
May I work on this rewriting?

from gimelstudio.

Correct-Syntax avatar Correct-Syntax commented on June 8, 2024

Hi, @Yashupadhyay603. Sure I'll assign you. If you have any questions feel free to ask.

from gimelstudio.

Yashupadhyay603 avatar Yashupadhyay603 commented on June 8, 2024

Hello @Correct-Syntax, I have seen the code to be changed .
I want to ask , how many fonts does OpenImageIO supports as opencv support only few types.
so using opencv would allow to use only few fonts.

from gimelstudio.

Yashupadhyay603 avatar Yashupadhyay603 commented on June 8, 2024

@Correct-Syntax , @iwoithe .
I have looked into both of these implementations and come to see a common process of importing font data from .ttf file.

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 ?

from gimelstudio.

Correct-Syntax avatar Correct-Syntax commented on June 8, 2024

@Yashupadhyay603

We want to access the system fonts folder and get a list of the available ttf fonts on the user's computer. Then use that to populate the font selector dynamically.

from gimelstudio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.