Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
I want to place some text on a existing image, but I want the image fit the text (not the other way around).
Let's say I have circle image and want to put some arbitrary text on it. I would like to resize/scale the circle image to the same size of the text.
When you have created an image that happens to be from text, you want to resize another image to the same dimensions, so the text will fit. Is that correct?
Resizing to dimensions calculated within one command is messy, but can be done with distort and a viewport.
you want to resize another image to the same dimensions, so the text will fit. Is that correct?
Yes! Instead of making the text to automatically fit the image (as you can fulfil by omitting the pointsize for a label), I want a static size of the text and the Image to fit the text instead.
If I understand what you want, you can create the text image with a transparent background using label: or caption:. Then you will need to resize your image to the size of the text image and composite them together. In order to know how to resize, you will have to get the text image size after creating it in a separate command. See string formats "%w" and "%h" at http://www.imagemagick.org/script/escape.php. I do not think this can be done in one single command line in IM 6.
Actually there is a way, if you know the size of the circle image ahead of time (since you have already created it). Assume my circle image is 256x256, then try (unix syntax)
Thank you fmw42 ! I have played around with both solutions and they may work for my scenarios!
1. Created a script that identifies the size of the text,resizes the image and then adds the text to the image
2. Your example with the circle works, but now I need to learn more about the commands and arguments you are using so I understand how it works so I can tweak it