Trying to Use Parens & Append

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
listsubscriber
Posts: 2
Joined: 2014-02-18T17:35:48-07:00
Authentication code: 6789

Trying to Use Parens & Append

Post by listsubscriber »

1st time poster
Im6, Linux Mint

I just started using IM and looked thru the examples as well as some of the questions on the forum, but I still can't seem to combine all these steps into 1. I basically want to take a jersey, a number, a name, and motto and a number, put the number, name, & motto on the jersey, and then watermark the image. Depending on the name, number & motto, resizing has to be done before placing it on the jersey.

Steps I'm using now which work fine, but there has to be a better way:

#create a file with the person's name
convert -size 1200x1200 xc:transparent -font athletic -pointsize 456 -fill white -annotate +200+350 "Name" name.png

#puts the name and a premade number file together
composite -dissolve 100% -quality 100 name.png 07.png nameNumber.png

# resizes the name/number file to fit on the currently selected jersey
convert -resize 35% nameNumber.png nameNumber-resized.png

# create the image with the motto text
convert -size 1200x1200 xc:transparent -font athletic -pointsize 228 -gravity center -fill white -annotate +0+96 "Motto" motto.png

# resize it to fit the curent jersey like the name/number image
convert -resize 35% motto.png motto-resized.png

# combine the two previously resized images
composite -dissolve 100% -quality 100 nameNumber-resized.png motto-resized.png nameNumberMotto-resized.png

#put the combnies name/number/motto on the blank jersey
composite -dissolve 100% -quality 100 -gravity center -geometry +0-100 nameNumberMotto-resized.png blankJersey.png jerseyPreWatermark.png

# watermark the image
composite -dissolve 2% -tile watermark.png jerseyPreWatermark.png jerseyNameNumberMotto.png

Just typing all this out, I KNOW there as to be a way to combine these. Nothing I've tried so far works. I think the arrays, -append, +append, etc is just too much for my slow mind!

Thanks in advance for any help you can provide.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trying to Use Parens & Append

Post by snibgo »

First rule: don't use "composite". Use "convert" instead. Then all the converts can be merged fairly easily.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Trying to Use Parens & Append

Post by fmw42 »

see
http://www.imagemagick.org/Usage/compose/#compose (for convert syntax vs composite syntax)
http://www.imagemagick.org/Usage/basics/#parenthesis (for parenthesis processing to combine commands into one)

Windows syntax does not escape the parens. see
http://www.imagemagick.org/Usage/windows/
listsubscriber
Posts: 2
Joined: 2014-02-18T17:35:48-07:00
Authentication code: 6789

Re: Trying to Use Parens & Append

Post by listsubscriber »

You guys are great! Convert seems to do the trick and I can just use parens and backslashes to chain the commands together!! Way too easy now!

Thanks.
Post Reply