Page 1 of 1

Images in Image stacks defy gravity

Posted: 2010-03-03T22:07:32-07:00
by hankr
I have been creating book covers with convert. I make a large rectangular canvas for the entire wrap around cover, then a image stack for the front that I float right (-gravity east), and then an image stack for the back that I float left (-gravity west). The images I float towards the spine, so I need to gravity them in the opposite direction of the front and back stacks. With ImageMagick-6.4.0 and prior this technique worked fine. A few short revs later, it stopped working and it still does not with 6.6.0. The annotations in the stacks respect the bounds and gravity of the stack, however images in the stack do not. If the front stack is gravity east, and the front image is gravity west to snug up against the spine, the front image gravitates allll the way to western most edge of the entire image, ignoring the -size of the stack.

Did something change with regards to image gravity inside stacks that causes them to ignore the stack size? I have tried offsets and many other techniques with no luck.

Here is the convert statement:

Code: Select all

convert -quality 95  -size 7307x3675 xc:#000000 \
# Front Image Stack \
-gravity east \( -size 3638x3675  xc:none -gravity center \( -gravity northwest  -resize 3638x3675! '/path/to/cover_front.jpg' \) -composite \) -compose over -composite \( -size 3638x3675 xc:none -pointsize 150 -fill '#FFFFFF' -stroke black -strokewidth 3.33 -gravity northwest -annotate +280+280 'This is the TITLE'  -pointsize 100 -fill '#FFFFFF' -stroke black -strokewidth 3.33 -gravity southeast -annotate +280+280 'By John Smith'  \) -compose over -composite \
#Back Image Stack \
-gravity west \( -size 3638x3675 xc:none -gravity center \( -gravity northeast -resize 3638x3675 "/path/to/cover_back.jpg" \) -composite \) -compose over -composite   "/path/to/final_cover.jpg"

Re: Images in Image stacks defy gravity

Posted: 2010-03-03T22:24:01-07:00
by fmw42
i am not too sure I follow all of this (or even what you mean by stack), but it may be possible that nested parenthesis are a problem. you might try un-nesting the parentheses and if necessary using clones.

The other thing to try is adding before the first parenthesis, -respect-parentheses (or -respect-parenthesis) and see if that helps.

Also try adding -compose over before each -composite.

Can you simplify this to two (smaller) pages and provide the exact command and the links to the images, so that others can test your code?

Re: Images in Image stacks defy gravity

Posted: 2010-03-03T22:26:49-07:00
by hankr
Woot! -respect-parentheses is, er, Magick! That did the trick perfectly. Thanks so much.

Re: Images in Image stacks defy gravity

Posted: 2010-03-03T22:39:45-07:00
by fmw42
FYI, -respect-parenthesis was added in IM 6.4.1-4