Page 1 of 1

convert -gravity misalignment

Posted: 2017-01-07T12:42:04-07:00
by dud
If I run the following command (copied/edited from video-contact-sheet) using imagemagick 6.9.6.8 or before, it produces neatly aligned rows of text. However since 6.9.7.1 the text to the right is cut off at the top.

Code: Select all

$ NL='
'
$ convert \( -size 1795x1 xc:white +size -font /usr/share/fonts/TTF/DejaVuSans.ttf -pointsize 14 -background white -fill black \( -gravity West \( label:Filename: label:FILENAME +append \) -font /usr/share/fonts/TTF/DejaVuSans.ttf label:'File size: SIZE' label:'Length: LENGTH' -append -crop 1813x69+0+0 \) -append \( -size 1813x69 -gravity East -fill black -annotate +0-1 "Dimensions: RESOLUTION${NL}Format: FORMAT${NL}FPS: FPS" \) -bordercolor white -border 9 \) out.png
Is it possible to attach the output of each version for comparison?

Re: convert -gravity misalignment

Posted: 2017-01-07T12:53:30-07:00
by fmw42
Is it possible to attach the output of each version for comparison?
Upload your images to some free hosting service such as dropbox.com and post the URLs here.

Re: convert -gravity misalignment

Posted: 2017-01-07T13:08:03-07:00
by dud
6.9.6.8:
Image
6.9.7.1:
Image

Re: convert -gravity misalignment

Posted: 2017-01-07T15:38:44-07:00
by fmw42
You need to put a +repage after your crop ...\) -append. Rewriting so that it is easier to read and using arial font since I did not have your font:

Code: Select all

NL='
'
convert \( -size 1795x1 xc:white +size -font arial -pointsize 14 -background white -fill black \
\( -gravity West \
\( label:Filename: label:FILENAME +append \) \
-font arial label:'File size: SIZE' label:'Length: LENGTH' -append -crop 1813x69+0+0 \) \
-append +repage \
\( -size 1813x69 -gravity East -fill black -annotate +0-1 "Dimensions: RESOLUTION${NL}Format: FORMAT${NL}FPS: FPS" \) \
-bordercolor white -border 9 \) \
out.png
But your code is way to complicated and mixes label and annotate. The following is much simpler and use \n directly rather than your NL variable, which could have been written NL="\n". It also just uses -annotate. Furthermore, no parentheses are needed.

Code: Select all

convert -size 1813x69 xc:white -font arial \
-pointsize 14 -background white -fill black \
-gravity West \
-annotate +0+0 'Filename: FILENAME\nFile size: SIZE\nLength: LENGTH' \
-gravity East \
-annotate +0+0 'Dimensions: RESOLUTION\nFormat: FORMAT\nFPS: FPS' \
-bordercolor white -border 9 \
out.png