Hi,
I have a image and a want to add some text on a specific X,Y location and bounded by a with and height.
I have read
http://www.imagemagick.org/Usage/annotating/#annotating
but can't get it to work ...
HELP?
creating textbox on top of image
Re: creating textbox on top of image
How about posting a copy of what you have tried.
Some examples on my site:
http://www.rubblewebs.co.uk/imagemagick/text.php
http://www.rubblewebs.co.uk/imagemagick/watermark.php
Some examples on my site:
http://www.rubblewebs.co.uk/imagemagick/text.php
http://www.rubblewebs.co.uk/imagemagick/watermark.php
Re: creating textbox on top of image
well first start was
but now my text just runs of the image
Code: Select all
$text="Verrrrrrryyyy loong an a lot of text what needs to be boundend by a with and height";
$command = $image_magick.' -resize 2480x3508 "'.$source_image.'" '.
' -font "'. $fonts["title"] .'" -pointsize 120 -fill white '.
' -draw "text 308, 530 \''.$text.'\'" "'.$target_image.'"';
passthru($command);
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: creating textbox on top of image
In stead of specifying a specific point size, let label: or caption:
automatically determine the best size for the text to fit into the area wanted.
See the "Auto-Sized Caption" example in Annotate
automatically determine the best size for the text to fit into the area wanted.
See the "Auto-Sized Caption" example in Annotate
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: creating textbox on top of image
hmm interresting .. I will try that ...
For now I've used this solution:
created a dummy transparent image with the width and height of the textbox and put de text in it. Then I merged the master image with the dummy image.
thnx
For now I've used this solution:
created a dummy transparent image with the width and height of the textbox and put de text in it. Then I merged the master image with the dummy image.
thnx
Re: creating textbox on top of image
Can you please provide some example code of how you did this?or now I've used this solution:
created a dummy transparent image with the width and height of the textbox and put de text in it. Then I merged the master image with the dummy image.
Re: creating textbox on top of image
Untested code but something like this should work:
Al on one line may work
This code can be expanded to specify a font coloured backgound or border to the text box etc.
Code: Select all
convert -size 200x100 xc:none caption: 'Some text here' text.png
composite -gravity center text.png image.jpg output.jpg
Code: Select all
convert -size 200x100 xc:none caption: 'Some text here' miff:- | composite -gravity center - image.jpg output.jpg
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: creating textbox on top of image
Or even one command!
Code: Select all
convert -size 200x100 xc:none caption: 'Some text here' \
image.jpg +swap -gravity center - composite output.jpg
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/