Autosize text based on label size, not image size
Posted: 2011-06-21T19:50:28-07:00
I'm trying to use convert to create a 640x480 transparent PNG, with a "header" at the top of the image that is 640x50 that will contain text that will autosize to best fit within the 640x50 size. Can this be done with a single call to convert, or do I need to use compose? In the end, I need to create the larger PNG with multiple areas of text that have to be autosized. (ie, a header line of text, a center line of text and a footer.) I don't want the text to be wrapped, but rather autofit to the height specified.
I can easily create a transparent PNG of 640x480; I can easily create 640x50 image that contains text that has been autosized, but I can't figure out how to do this into one call to convert. I've tried various incantations, but here is the latest:
My thoughts were that this would create the image as a 640x480, but change the canvas to 640x50 for the label. However, my -repage seems to have no effect as the text is resized for the entire 640x480, not the smaller 640x50.
What am I missing?
I can easily create a transparent PNG of 640x480; I can easily create 640x50 image that contains text that has been autosized, but I can't figure out how to do this into one call to convert. I've tried various incantations, but here is the latest:
Code: Select all
convert -size 640x480 -background none -repage 640x50 label:'Header Txt' image.png
What am I missing?