Text in speach bubble over image?

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?".
Post Reply
SamWabam
Posts: 1
Joined: 2012-04-13T14:37:52-07:00
Authentication code: 8675308

Text in speach bubble over image?

Post by SamWabam »

Hi fairly new to image magick but but quite experienced in php, sql, css, html.

I have created a form with two fields, one field for an image and another for text.

Basically I want my users who fill out the form to be able to position the text on the image and then a speech bubble automatically created around the text.

I have seen that image magick can be used to overlay text/images so I know it has the basic function to. But Im looking for advice, is anything like this already done where I can pick up from/modify or will I have to go through it all myself.

Also is it possible for the image/text to be positioned on the image by dragging/clicking where the image should be positioned or will it have to be done through coding/styling?

Lastly how can I get the speach bubble to be resized depending on the length of the text, or is it possible for my interface to have a choice of which speech bubble to use, how could I go about implemeting this?

Thanks for any advice.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Text in speach bubble over image?

Post by fmw42 »

SamWabam wrote:Hi fairly new to image magick but but quite experienced in php, sql, css, html.

I have created a form with two fields, one field for an image and another for text.

Basically I want my users who fill out the form to be able to position the text on the image and then a speech bubble automatically created around the text.

I have seen that image magick can be used to overlay text/images so I know it has the basic function to. But Im looking for advice, is anything like this already done where I can pick up from/modify or will I have to go through it all myself.

Also is it possible for the image/text to be positioned on the image by dragging/clicking where the image should be positioned or will it have to be done through coding/styling?

Lastly how can I get the speach bubble to be resized depending on the length of the text, or is it possible for my interface to have a choice of which speech bubble to use, how could I go about implemeting this?

Thanks for any advice.

There is nothing that I know about, especially nothing directly in Imagemagick. Others may know more.

Most of what you want to do can be done by scripting, for example using PHP and its exec() function to call IM commands. The drag and drop, you will have to use javascript and/or ajax. IM can create the text as an image that can be specified in widthxheight with fontname and automatically get the pointsize to fill it out (see label: or caption:). Then you overlay that text image onto your background image where you want. Alternately, you can provide the fontname, pointsize and coordinates and just draw the text over the image (see -draw or -annotate). see http://www.imagemagick.org/Usage/text/

With respect to your bubble, you will have to resize that on the basis of the text box created, if you use label: or caption:. With annotate, you can also get font metrics that I believe include the size of the bounding box.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Text in speach bubble over image?

Post by anthony »

Alternativeally. Have a record of how much space and where in the 'bubble' image, in which you can put your text. Use caption: with the size of that sapce, and overlay it into the buuble image with the right position. Once the bubble image is prepared, overlay it onto the users image in the position the user indicated.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply