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?".
eps
Post
by eps » 2010-03-29T11:58:34-07:00
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
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
Last edited by eps on 2010-03-30T13:32:33-07:00, edited 4 times in total.
el_supremo
Posts: 1015 Joined: 2005-03-21T21:16:57-07:00
Post
by el_supremo » 2010-03-29T12:22:56-07:00
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
Sorry, my ISP shutdown all personal webspace so my
MagickWand Examples in C is offline.
See my message in
this topic for a link to a zip of all the files.
eps
Post
by eps » 2010-03-29T13:17:39-07:00
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
el_supremo
Posts: 1015 Joined: 2005-03-21T21:16:57-07:00
Post
by el_supremo » 2010-03-29T14:43:37-07:00
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
Sorry, my ISP shutdown all personal webspace so my
MagickWand Examples in C is offline.
See my message in
this topic for a link to a zip of all the files.
eps
Post
by eps » 2010-03-29T15:18:27-07:00
Still cant get it working. What I need is;
and what I am getting is
and if there is a better way to do it I am happy to do that.
Mike
el_supremo
Posts: 1015 Joined: 2005-03-21T21:16:57-07:00
Post
by el_supremo » 2010-03-29T16:48:26-07:00
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
Sorry, my ISP shutdown all personal webspace so my
MagickWand Examples in C is offline.
See my message in
this topic for a link to a zip of all the files.
el_supremo
Posts: 1015 Joined: 2005-03-21T21:16:57-07:00
Post
by el_supremo » 2010-03-29T17:14:19-07:00
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
Sorry, my ISP shutdown all personal webspace so my
MagickWand Examples in C is offline.
See my message in
this topic for a link to a zip of all the files.
eps
Post
by eps » 2010-03-30T11:01:12-07:00
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
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2010-03-30T11:04:35-07:00
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.
eps
Post
by eps » 2010-03-30T11:58:37-07:00
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
eps
Post
by eps » 2010-03-30T13:31:20-07:00
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;
Mike