Book Image

ImageMagick Tricks

By : Sohail Salehi
Book Image

ImageMagick Tricks

By: Sohail Salehi

Overview of this book

<p>The book is packed with interesting and fun examples. We had a lot of fun coming up with cool ways to demonstrate ImageMagick's power, and we're sure you'll have fun learning how to create them.<br /><br />Although the printed book is in black and white, there is a full colour PDF of the screenshots freely available that includes all of the images in the book. Use it to see exactly what the ImageMagick effects look like in colour, or browse through it and see just what you'll learn to do with this book.<br /><br />ImageMagick is a free software suite to create, edit, and compose bitmap images using text-based commands. The commands can be issued from the command line, but more often will be included in web or desktop applications &acirc;&euro;&ldquo; carrying out complex image-manipulation tasks in response to the user's input.<br /><br />ImageMagick is a popular way for generating images on-the-fly in web pages, whether it's generating thumbnails from a large image, or creating complex combinations of images, text, and effects chosen by a visitor or the web site's creator.</p>
Table of Contents (18 chapters)
ImageMagick Tricks
Credits
About the Author
About the Reviewers
Preface
5
Identify, Display, and Import
Index

How to Make Input Text more Flexible


You may have noticed that there are some limitations for text space in the previous scripts. On the other hand we have to obey the specified text size and length and number of lines specified earlier on in those workshops.

Is it possible to implement a mechanism in which the input text understands the space it has and makes any necessary changes in the size or break itself as a multi-line phrase? Yes it is possible. We just need to change the ImageMagick commands.

In the current commands we set a specific number of lines and used the -pointsize option to fix the size of input texts so that it fits into specific areas of our images.

Another alternative is using the -size and -caption options. For example, we can set the typing area as follows:

convert -background lightgray -size 70x120
caption:"here it is a long text" textfit.png

As you see a 120 pixel wide area is defined for the text and can be shown as follows:

Fig 10-11: Defined Text Area

So if the...