append and positioning

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
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

append and positioning

Post by agriz »

How do i re-position images when i use +append?

Code: Select all

convert -size 500x500 image1.jpg image2.jpg image3.jpg image4.jpg +append output.jpg
How do i move those images over that 500x500 canvas?
I can use -composite. How do i do it with append?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: append and positioning

Post by fmw42 »

See -swap at http://www.imagemagick.org/Usage/basics/#swap. You can also just list your images in the order you want them appended. There is no need for -size 500x500. The output of append will be as large as needed to hold your images.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: append and positioning

Post by fmw42 »

See http://www.imagemagick.org/Usage/layers/#append. Append just puts the images together. It has no size control. Any mismatched sizes will be filled with background color. If you want to put images in special places in a 500x500 background image, then you need either -compose over -composite (pair-wise) or -page ... -flatten. See http://www.imagemagick.org/Usage/layers/#flatten
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: append and positioning

Post by Bonzo »

I think this is a follow on post from this thread fmw42
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: append and positioning

Post by Bonzo »

I would probably use -layers and there are some examples on this page
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: append and positioning

Post by agriz »

Yes sir. But question will be useful to others. I asked here.
Thanks for layers link. It is working good.

Is there any face detecting algorithm in imagemagick?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: append and positioning

Post by Bonzo »

Not that I know of; but there was a thread about it a couple of years ago. I tried it out with php and an external library but I have formatted my PC since then and no longer have the code.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: append and positioning

Post by Bonzo »

I have had a look through the forum and I based my code on: http://liuliu.me/ccv/js/nss/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: append and positioning

Post by fmw42 »

Bonzo wrote:I have had a look through the forum and I based my code on: http://liuliu.me/ccv/js/nss/
What was the outline of the methods used in your IM code or do you have a link to your IM code.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: append and positioning

Post by Bonzo »

I have deleted the code from my server and PC.

As far as I can remember:
1/ Send the image from the webpage to php via Ajax and base64
2/ Save a temporary file for the next stage. If you can remember back a few years I was having a problem with base64 and so I had to do this step with GD as I could not get IM to work. If I could have got the base64 to work I could probably have avoided the temporary image.
3/ Cropped out all the heads with IM and saved each one.
4/ Draw a red square outline around each head with IM, resize and save.

It worked quite well on my sample images but I did not take it any further. The main idea was to generate a webpage with the main image and heads outlined then a list of heads with a space next to it. I was then going to supply links to relatives and they could then use an online form to fill in the missing names or supply alternative names if they thought any were incorrect.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: append and positioning

Post by fmw42 »

The question is how did you detect where the head areas were in the image.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: append and positioning

Post by Bonzo »

I used http://liuliu.me/ccv/js/nss/ and it gave me the co ordinates
Post Reply