Page 1 of 1

Can't append vertically?

Posted: 2008-12-29T16:03:07-07:00
by jhfry
Windows bat script:

Code: Select all

convert ^
	( ^
		-size 1280x1024 ^
		xc:none ^
		-gravity center ^
		-font Palatino-Linotype-Bold ^
		-pointsize 20 ^
		-density 96 ^
		-fill white ^
		-stroke black ^
		-annotate 0 "Small Text" ^
		( ^
			+clone ^
			-background black ^
			-shadow 70x2+2+2 ^
		) ^
		+swap ^
		+composite ^
		-trim ^
		-gravity north ^
	) ^
	( ^
		-size 1280x1024 ^
		xc:none ^
		-gravity center ^
		-font Palatino-Linotype-Bold ^
		-pointsize 45 ^
		-density 96 ^
		-fill white ^
		-stroke black ^
		-annotate 0 "Large Text" ^
		( ^
			+clone ^
			-background black ^
			-shadow 70x4+5+5 ^
		) ^
		+swap ^
		+composite ^
		-trim ^
		-gravity north ^
	) ^
	+append ^
output.png 
Works, the two shadowed text blocks are appended horizontally.

If I change the +append to -append to append them vertically, I get two separate images called output-1.png and output-2.png. I don't get it, why can it do it horizontally but not vertically?

I experimented with changing the text of the second line and it works so long as the first layer is wider than the second. I don't understand why there is a restriction, or how to work around it! This will eventually be used in a script and therefore I cannot statically assign any sizes. I also tried doing a +swap just before the -append... and again it works as the top layer is larger than the bottom when they are swapped.

I am guessing that append will not allow an increase in the width during a vertical append, though it does allow an increase in height during a horizontal append. Perhaps its a bug?

Help please!

Re: Can't append vertically?

Posted: 2008-12-29T23:29:38-07:00
by anthony
A few things first off.
  • +composite should be -composite, though that should make no difference.
  • Also -gravity north at the END of the parenthesis blocks, does not do anything there, it really should be placed before the append, which is where it is actually used.
I converted the script to linux, replaced the +append with -append and for some reason it is not applied at all!

Looks like a gravity related bug, as when I remove the -gravity north is started working, adding -gravity north or -gravity center before the -append and it fails again.

Re: Can't append vertically?

Posted: 2008-12-30T07:36:36-07:00
by jhfry
Trust me, I tried that... here is my simplified code:

Code: Select all

convert ^
	( ^
		-size 1280x1024 ^
		xc:none ^
		-gravity center ^
		-font Palatino-Linotype-Bold ^
		-pointsize 20 ^
		-fill white ^
		-annotate 0 "Small Text" ^
		( ^
			+clone ^
			-background black ^
			-shadow 70x2+2+2 ^
		) ^
		+swap ^
		-composite ^
		-trim ^
	) ^
	( ^
		-size 1280x1024 ^
		xc:none ^
		-gravity center ^
		-font Palatino-Linotype-Bold ^
		-pointsize 45 ^
		-fill white ^
		-annotate 0 "Large Text" ^
		( ^
			+clone ^
			-background black ^
			-shadow 70x4+5+5 ^
		) ^
		+swap ^
		-composite ^
		-trim ^
	) ^
	-append ^
output.png 
Still the same problem. If I take out the "-gravity center" from each line of text, I get a single image output... but much of each line is cut off. (I placed the text at the center of a large canvas to ensure that none of it gets clipped when it is shifted by -shadow).

Each of the two output images are exactly what I'm looking for... but I cannot have them append in the correct order. I can put the "large text" line above the "small text" line... or I can append them horizontally. It's really strange.

Is there a way to trim each line vertically but not horizontally... then I'd have two 1280x?? layers that should append vertically just fine... then I could simply trim again after appending them.

Thanks for your help!

Re: Can't append vertically?

Posted: 2008-12-30T07:38:21-07:00
by magick
The problem you reported is fixed in ImageMagick 6.4.8-3 Beta available sometime tomorrow. Thanks.

Re: Can't append vertically?

Posted: 2008-12-30T07:47:54-07:00
by jhfry
Thanks Magick... I thought I was going crazy!