Where are tutorials/orientation for adding strings to image at random locations?

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
CJSHayward
Posts: 1
Joined: 2017-08-17T17:26:58-07:00
Authentication code: 1151

Where are tutorials/orientation for adding strings to image at random locations?

Post by CJSHayward »

$ convert --version
Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-07-26 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

I am interested in creating a book cover for anthologies, and would like to have the titles of individual works displayed randomly centered across the screen, with a translucent black color and with some titles predictably cropped due to center and/or length.

What can I do to set a background image, and then specify, "Insert this text, in this font and size, with this RGBA and color, clipped if the text goes past the bounds of the preset image dimensions", repeating as many times as needed and finally adding a cover and author name?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Where are tutorials/orientation for adding strings to image at random locations?

Post by fmw42 »

Basic text to image is at http://www.imagemagick.org/Usage/text/. You can create any color background using -size WxH xc:somecolor. See http://www.imagemagick.org/Usage/canvas/. You can create random number using -format "%[fx:random()]". See http://www.imagemagick.org/script/fx.php and http://www.imagemagick.org/Usage/transform/#fx_escapes. I have a script, text distort, at my link below. You could just use a black background image with it.

Perhaps you could show us an example of what you want. You can upload to any free hosting service and put the URL here.

IM 6.9.1.10 is a bit old (about 80 versions old), but should be OK.

For novices, see

viewtopic.php?f=1&t=9620
http://http://www.imagemagick.org/scrip ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
Post Reply