That's very intuitive and sensible. Although when I tried to move the "+noise random" to the end of the grouping of options that affect it, it totally changed the result.snibgo wrote: Personally, I usually put settings immediately before the operations they affect.
Commands should always be written in logical, chronological order. Do this, then do that, then do something else. Put settings before the operators they should affect, and so on.
I like how fmw42 consolidated all the OPs code into one command, so I've been trying to maintain that style. But once multiple rubber stamps are needed, the code repetition is terrible. So I refined it to this bash code (which invokes convert 3 times):
Code: Select all
stamp()
{
local lbl=$1
local sz_opt=${2:+-size "$2"}
convert \( $sz_opt -pointsize 128 -gravity center \
-font Arial -background white \
-fill red label:"$lbl" -fill none \) \
\( $sz_opt xc: +noise random -channel g -separate +channel \
-blur 0x2 -threshold 55% -transparent black \) \
-compose over -composite -fuzz 10% -transparent white miff:-
}
convert <(stamp Top 500x200) rose: <(stamp Bottom 500x200) \
-background transparent -append -rotate 90 -gravity east wizard: +swap -composite show:
Notice that the rose is no longer centered:
(direct link)
The append operation lost the side-effect of the "-gravity center" that was inside the stamp grouping, thus changed behavior when the stamp imaging became externally sourced. This is expected, since -gravity is an image setting. So if I add an extra "-gravity center" before "-append", I get:
(direct link)