Gravity won't work properly

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
bdg
Posts: 4
Joined: 2015-02-01T06:12:05-07:00
Authentication code: 6789

Gravity won't work properly

Post by bdg »

Hi

Have some issues with my montage of 4 images. They are colums that have differnt highs depending on weather conditions.

At first it worked ok, but at some point, after a reinstall i think, they are suddenly aligned at the top. Se the actual image added to the webcam image here:
http://selevaret.casadelsele.com/wxwebcam.php

Code: Select all

montage \
-label $rain_1h_label $rain_1h_file \
-label $rain_24h_label $rain_24h_file \
-label $temp_label $temp_file \
-label $wind_label $wind_file \
-background none \
-font '/home/selevaret/public_html/images/cb/arial.ttf' \
-fill 'yellow' \
-pointsize 15 \
-gravity south \
-geometry +2+2 \
-tile 4x1 tmp.gif

mv tmp.gif $outfile
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Gravity won't work properly

Post by fmw42 »

I do not see any input images in your command
bdg
Posts: 4
Joined: 2015-02-01T06:12:05-07:00
Authentication code: 6789

Re: Gravity won't work properly

Post by bdg »

Input images is in the label in a variable... that variable contains the filename.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Gravity won't work properly

Post by fmw42 »

As far as I know, there has always been an issue with -gravity in montage. All the images are north justified, except the very last one, no matter what gravity you set.

Try these experiments:

Code: Select all

convert -respect-parenthesis logo: \
\( -clone 0 -resize 10% -write tmp1.png \) \
\( -clone 0 -resize 30% -write tmp2.png \) \
\( -clone 0 -resize 40% -write tmp3.png \) \
\( -clone 0 -resize 20% -write tmp4.png \) \
-delete 0 null:

Code: Select all

montage tmp1.png tmp2.png tmp3.png tmp4.png -gravity south -background black -geometry +2+2 -tile 4x1 result_south.png

Code: Select all

montage tmp1.png tmp2.png tmp3.png tmp4.png -gravity north -background black -geometry +2+2 -tile 4x1 result_north.png
This is a workaround for gravity south:

Code: Select all

convert tmp1.png tmp2.png tmp3.png tmp4.png -flip miff:- |\
montage - -gravity north -background black -geometry +2+2 -tile 4x1 miff:- | convert - -flip result_south_good.png
I tested several versions of IM back to 6788 and they all have the same issue.
bdg
Posts: 4
Joined: 2015-02-01T06:12:05-07:00
Authentication code: 6789

Re: Gravity won't work properly

Post by bdg »

Thanx. will try to explore these options:)
bdg
Posts: 4
Joined: 2015-02-01T06:12:05-07:00
Authentication code: 6789

Re: Gravity won't work properly

Post by bdg »

Solved it by using convert and +append. And made the labels on a seperate image and added thet with -append:)
Post Reply