Images in Image stacks defy gravity

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
hankr

Images in Image stacks defy gravity

Post 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"
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Images in Image stacks defy gravity

Post 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?
Last edited by fmw42 on 2010-03-03T22:29:12-07:00, edited 1 time in total.
hankr

Re: Images in Image stacks defy gravity

Post by hankr »

Woot! -respect-parentheses is, er, Magick! That did the trick perfectly. Thanks so much.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Images in Image stacks defy gravity

Post by fmw42 »

FYI, -respect-parenthesis was added in IM 6.4.1-4
Post Reply