I am using the GraphicsMagick node.js module .
In my Node JS application, I need to add a text label to an existing image so that: 1) If the text is longer than the image size, the text automatically wraps around the next line 2) If the text cannot fit in the image, the font size of the text is automatically adjusted (reduced) to insert him in the image field
The available APIs from the GraphicsMagick node.js module are:
gm ("img.png"). drawText (x, y, text [, gravity])
But this does not give any options to insert text into the field according to the two above requirements. If I use only this API, I will need to manually split the text and change the font size of the text to fit the image, but even for this I will need to measure the text size first. Is there any way to do this?
Any suggestions?
To illustrate, the figure below shows three different text strings that should be inserted into a box of the same size. I hope he clarifies.
source
share