Page 1 of 1

Combining commands - Solved

Posted: 2010-03-29T11:58:34-07:00
by eps
I am trying to create an image from 1 single image, in this case 19.jpg from the Windows command prompt. If I carry out the following commands in order I can create the image.

Code: Select all

convert 19.jpg -resize 1200 -gravity west -extent 2700x1800 19_layout.jpg

Code: Select all

convert 19.jpg -resize 570 19_small.jpg

Code: Select all

error removed

Code: Select all

composite -geometry +1480+40 19_small.jpg 19_layout.jpg

Code: Select all

composite -geometry +2090+40 19_small.jpg 19_layout.jpg

Code: Select all

composite -geometry +1480+920 19_small.jpg 19_layout.jpg

Code: Select all

composite -geometry +2090+920 19_small.jpg 19_layout.jpg
Obviously what I would like to do is create this with one command and I am not understanding how to do this. Any help appreciated.

Mike

Re: Combining commands

Posted: 2010-03-29T12:22:56-07:00
by el_supremo
This should replace the last four commands in your list:

Code: Select all

convert 19_layout.jpg 19_small.jpg -geometry +1480+40 -composite -geometry +2090+40 19_small.jpg -composite -geometry +1480+920 19_small.jpg -composite -geometry +2090+920 19_small.jpg -composite 19_layout.jpg
If that works, then we can add the others to that command.

Is the third command in your list a mistake?

Pete

Re: Combining commands

Posted: 2010-03-29T13:17:39-07:00
by eps
Third line was a mistake.

I tried your script and the first image is added correctly but the second and subsequent are put in the top left corner.

thanks for the help so far.

Mike

Re: Combining commands

Posted: 2010-03-29T14:43:37-07:00
by el_supremo
OK, try this:

Code: Select all

convert 19_layout.jpg 19_small.jpg -geometry +1480+40 -composite +repage -geometry +2090+40 19_small.jpg -composite +repage -geometry +1480+920 19_small.jpg -composite +repage -geometry +2090+920 19_small.jpg -composite 19_layout.jpg
Pete

Re: Combining commands

Posted: 2010-03-29T15:18:27-07:00
by eps
Still cant get it working. What I need is;

Image

and what I am getting is

Image

and if there is a better way to do it I am happy to do that.


Mike

Re: Combining commands

Posted: 2010-03-29T16:48:26-07:00
by el_supremo
OK, I tested a version of this and this one should work. The geometry has to be specified in front of the -composite operator, not in front of the file.

Code: Select all

convert 19_layout.jpg 19_small.jpg -geometry +1480+40 -composite 19_small.jpg -geometry +2090+40 -composite 19_small.jpg -geometry +1480+920 -composite 19_small.jpg -geometry +2090+920 -composite 19_layout.jpg
Pete

Re: Combining commands

Posted: 2010-03-29T17:14:19-07:00
by el_supremo
If that one works, this should combine it all into one command (I hope):

Code: Select all

convert ( 19.jpg -resize 1200 -gravity west -extent 2700x1800 ) ( 19.jpg -resize 570 -write mpr:small ) -geometry +1480+40 -composite mpr:small -geometry +2090+40 -composite mpr:small -geometry +1480+920 -composite mpr:small -geometry +2090+920 -composite 19_layout.jpg
Pete

Re: Combining commands

Posted: 2010-03-30T11:01:12-07:00
by eps
Thanks for the code, I tried it but had to modify as follows;

Code: Select all

convert ( 19.jpg -resize 1200 -gravity west -extent 2700x1800 ) ( 19.jpg -resize 570 -write mpr:small ) -geometry +1480-430 -composite mpr:small -geometry +2090-430 -composite mpr:small -geometry +1480+440 -composite mpr:small -geometry +2090+440 -composite 19_layout.jpg
I cant work out why I needed the minus distances (each of which is 480px away from where I would expect).

Mike

Re: Combining commands

Posted: 2010-03-30T11:04:35-07:00
by fmw42
try adding -respect-parenthesis after convert before your first paren. the -gravity west may be passing on to all the subsequent parts

or after your second paren, add -gravity north to reset it.

Re: Combining commands

Posted: 2010-03-30T11:58:37-07:00
by eps
Well thanks for all the help, I used the following and it works a treat;

Code: Select all

convert ( 19.jpg -resize 1200 -gravity west -extent 2700x1800 ) ( 19.jpg -resize 570 -write mpr:small ) -gravity NorthWest -geometry +1480+40 -composite mpr:small -geometry +2090+40 -composite mpr:small -geometry +1480+920 -composite mpr:small -geometry +2090+920 -composite 19_layout.jpg
Just need to add the text now

Mike

Re: Combining commands

Posted: 2010-03-30T13:31:20-07:00
by eps
Thanks for all the help. Final code will rotate the image so that it is taller than it is wide and actual text will be added later.

Code: Select all

convert ( 19.jpg -rotate -90> -resize 1200 -gravity west -extent 2700x1800 ) ( 19.jpg -rotate -90> -resize 570 -write mpr:small ) -gravity NorthWest -geometry +1480+40 -composite mpr:small -geometry +2090+40 -composite mpr:small -geometry +1480+920 -composite mpr:small -geometry +2090+920 -composite -pointsize 100 -annotate 270x270+1320+1700 "caption will go here" -pointsize 75 -annotate 270x270+1440+1700 http://www.myphotoshere.co.uk/password.html 19_layout.jpg

and this is the result;

Image

Mike