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?".
Hello
I use convert to generate an image using the command below. It works for me, but when i want to add a barder, i obtain a bad result.
I explain my code, I generate a transparent (png) image contains a text with background texture (for the text).
I want to add a border to the text and I get a bad result
Create your green text image. Then create a larger background image that your green texture. Then overlay your text image onto the background green image in the center of the background image.
Thank you for your answer.
I finaly fix this problem and get a good rsult, but i still have a problem. The text remains glued to the border using different fonts. who can help me to solve this problem
My command is :
Make your background green image bigger and pad your text image before compositing by adding -bordercolor white or none (as appropriate) and -border X where X will be the pad amount.
Thank you for your answer
But i don't understand what do you mean. I genereate my image with text without background green image. i add a border on the same time as the text.
You can edit my command with your proposition and explain please.
tunezio wrote:The text remains glued to the border using different fonts. who can help me to solve this problem
Most fonts are designed with some amount of space above and below the character, but each font will be different from another. For example, your "spiderman.ttf" leaves almost no whitespace above the text and a lot of space below it. That's up to the designer of the font. It's not really an ImageMagick thing. You'll have to deal with each font differently and/or write your commands to handle those variables.
If you want to make sure there's some space around your text, do what fmw42 suggested and add a transparent or white border to your text block right after you create it. Maybe even try "-trim" to remove the uneven space surrounding the text block, then add the borders to make the same amount of padding all around.
You provided the wrong font for your example and that code does not work for me. It only fills in the first letter with green. Nevertheless, if you want spaces, try
The new code is the third line and replaces simply your -border 8x8. If you want more space, then increase the first -border size after the -trim
Also it is easier to read, though I did not follow your code at all, if you break into logical sections using \ at the end of the line and a line feed afterwards.