[magick-users] ImageMagick command composition basics
Anthony Thyssen
anthony at griffith.edu.au
Sun Sep 23 18:41:14 PDT 2007
T o n g on wrote...
| Hi,=20
|
| Here are some very basic questions that I had been wanting to
| know. Upstanding them will help me apply the examples from=20
| http://www.imagemagick.org/Usage/ creatively, instead of using them
| as cookie cutters.
|
| - what's the difference between -draw, -annotate and -label?
|
Draw is the lowest level draw test routine. It will not do 'percent
escapes' But other than that you can use it for everything -annotate
can do.
-annotate is the main tool for drawing text strings onto existing
images. It handles lines with returns, percent escapes, gravity
(and gravity justification -- wish they speperate this!), rotations,
skewing of text, and you don't need to deal with quotes withing quotes
as you do with -draw.
-label does nothing but define a string with percent escapes that will
be attached to images that are read in AFTER the option has been give.
To set a label on image that have already been read into memory use
"-set label '...'" instead. Montage uses the label setting, and many
image formats will save the label meta-data. JPEG does not use 'label'
but does have a -comment meta-data setting that can be used instead.
Comments are used for word wrapped paragraphs.
label: is I think what you really mean. This is a image CREATOR
it does not draw over an exsiting image, but creates an image of the
current background color the appropriate size to hhold the string which
is then drawn into that blank image.
caption: is exactly like label: but word-wraps to fit a image of as
specific size.
Clear?
| I figured out that the following 2 are equal, are they?
|
| -draw "text 28,68 'Anthony'"
|
| and
|
| -annotate +28+68 'Anthony'
|
Yes, except -annotation has percent escapes. But you also have to be
able to handle double quoting of the string in -draw.
See handling -draw quotes in...
To Quote or Backslash?
http://www.imagemagick.org/Usage/draw/#quote
| - how to come up with fancy ImageMagick commands as normal user? I mean,=20
| for a command as complicated as this,
|
| convert -size 100x25 xc:none -gravity center \
| -stroke black -strokewidth 2 -annotate 0 'Faerie Dragon' \
| -channel RGBA -blur 0x3 \
| -stroke none -fill white -annotate 0 'Faerie Dragon' \
| +size logo: +swap \
| -gravity south -geometry +0-2 -composite anno_fancy.jpg
|
| it would be very unlikely for a person who don't know convert command syn=
| tax
| to his heart to come up with one on first attempt. Could you show me how =
| the
| command can be build step by step -- starting from as simple as possible =
| and
| arrive at this point as many steps as possible?
|
| As a more easier practice, I tried to decompose the steps, but failed:
|
Each of the options are performed one step at a time, in the order
given.. The importatate options are the operators, they DO THINGS
anything else is basically a setting for a later operator
create a transparent image
-size 100x25 xc:none
Set lots of options then annotate test onto that blank image.
-gravity center -stroke black -strokewidth 2
-annotate 0 'Faerie Dragon'
Blur image of drawn text.
-channel RGBA -blur 0x3
Draw text again in a different color
-stroke none -fill white -annotate 0 'Faerie Dragon'
create a logo image in the image sequence
+size logo:
swap the two images
+swap
compose the second 'text' image onto 'logo' at a specify spot
-gravity south -geometry +0-2 -composite
LAST operator -- write it out
anno_fancy.jpg
NOTE how every step in the above ends in an OPERATOR.
all other options before the operator sets or adjusts existing settings
for the next and later operators.
| The error is:
|
| convert: no such image `anno_fancy.step1.jpg'.
|
Usally that means you have no image on which to apply the operator
First operation using creates or reads in some image.
Anthony Thyssen ( System Programmer ) <A.Thyssen at griffith.edu.au>
-----------------------------------------------------------------------------
Any problem in computer science can be solved
with one more level of indirection. --- Morven's Metatheorum
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
More information about the Magick-users
mailing list