Render text to new image
Posted: 2011-05-17T08:21:34-07:00
Hi there! After search and try for weeks I finally decided to ask you, either if its not possible, to render text (multi- or singleline) into a new image?
So what I really want is a command, to send the following parameters:
- maxwidth
- text
- font to use (like C:\Inetpub\wwwroot\myweb\fonts\arial.ttf)
- fontsize
- fontcolor
- kerning
- wordspacing
- leading
- backgroundcolor ( a color or 'none' )
- path to the file to create (like C:\inetpub\wwwroot\myweb\text1.png)
The fontsize should not be influenced by the image-dimensions, like caption does. Also it would be great to keep the maxwidth optional, so I would have two methods, encapsulating the commands, one for single line text (without maxwidth) and one with multiline text (maximal width by maxwidth). The magick is to find out
- the width and height if the text is singleline
- the height if the text is multiline
All I want is to render the text into a new image so I can resolve the width & height of the image as text bounds after creation and an auto-breaking text if I specify a maxwidth.
Does anyone know if its possible to do this? And if, how...?
Thanks!
So what I really want is a command, to send the following parameters:
- maxwidth
- text
- font to use (like C:\Inetpub\wwwroot\myweb\fonts\arial.ttf)
- fontsize
- fontcolor
- kerning
- wordspacing
- leading
- backgroundcolor ( a color or 'none' )
- path to the file to create (like C:\inetpub\wwwroot\myweb\text1.png)
The fontsize should not be influenced by the image-dimensions, like caption does. Also it would be great to keep the maxwidth optional, so I would have two methods, encapsulating the commands, one for single line text (without maxwidth) and one with multiline text (maximal width by maxwidth). The magick is to find out
- the width and height if the text is singleline
- the height if the text is multiline
All I want is to render the text into a new image so I can resolve the width & height of the image as text bounds after creation and an auto-breaking text if I specify a maxwidth.
Does anyone know if its possible to do this? And if, how...?
Thanks!