Page 1 of 2

[Solved] Laying out an aceo or wallet sheet

Posted: 2013-05-17T12:25:43-07:00
by holden
I haven't been able to find anything in my searches for this- How does one composite the same image multiple times at different locations, like this for example: http://www.pasteall.org/pic/51512 (cool dwarf sprite is from Battle for Wesnoth :D ). I also need to perform crop/scale ahead of the composite, but that I can do. I'd like to be able to integrate it into code similar to this:

Code: Select all

convert -size 3000x2400 xc:white ( dwarf.jpg -resize 600x -gravity center -profile foo.icc ) -composite dwarfaceo.jpg
Thanks

Re: Laying out an aceo or wallet sheet

Posted: 2013-05-17T12:48:01-07:00
by GreenKoopa
Does this meet your need?
http://www.imagemagick.org/Usage/layers/#flatten

There are other methods, such as using -draw image, or -border then -append.

Re: Laying out an aceo or wallet sheet

Posted: 2013-05-17T13:24:30-07:00
by snibgo
For repeating the same image without re-reading it, see also http://www.imagemagick.org/script/comma ... .php#clone

Re: Laying out an aceo or wallet sheet

Posted: 2013-05-17T14:28:06-07:00
by fmw42
You can make a montage of the same image by using -duplicate.

see
http://www.imagemagick.org/Usage/montage/
http://www.imagemagick.org/script/comma ... #duplicate

Re: Laying out an aceo or wallet sheet

Posted: 2013-06-19T12:57:00-07:00
by holden
This has been put on the back burner, but I'm now getting back to it- thanks for the replies so far.
Quick question, what is the difference between flatten and composite? Is one faster/better? All I need to do is make a single image from 2 or more images, no animation.

Re: Laying out an aceo or wallet sheet

Posted: 2013-06-19T13:04:41-07:00
by fmw42
composite only processed two images at a time. flatten can combine many images at the same time.

see
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/layers/#flatten

Re: Laying out an aceo or wallet sheet

Posted: 2013-06-19T13:46:08-07:00
by holden
I'm having issues once I get to the point where I need to rotate the image on the bottom, Everything gets a bit crazy. I tried flattening before the rotation operations but that doesn't work either, here is an example iteration of what I have tried (aceotest.jpg is a 750x1050 image):

Code: Select all

convert -size 2400x3000 xc:white ^
-page +39+36 aceotest.jpg ^
-page +824+36 aceotest.jpg ^
-page +1611+36 aceotest.jpg ^
-page +39+1124 aceotest.jpg ^
-page +824+1124 aceotest.jpg ^
-page +1611+1124 aceotest.jpg ^
-layers flatten ^
(aceotest.jpg -rotate 90 +131+2208) ^ #< can't figure out this line
-layers flatten compo.jpg

Re: Laying out an aceo or wallet sheet

Posted: 2013-06-19T14:24:23-07:00
by GreenKoopa
Spaces are required on each side of the parentheses. You are missing -page on the problematic line.

Re: Laying out an aceo or wallet sheet

Posted: 2013-06-19T14:55:56-07:00
by holden
Hmm, yeah I missed the spaces, I knew that! :lol:
But any time I put the rotate command on that last line it offsets the previously laid out images. Here is a test image http://www.pasteall.org/pic/53798 if you want to try.

Re: Laying out an aceo or wallet sheet

Posted: 2013-06-19T15:00:59-07:00
by GreenKoopa
Try -repage or -set page. It is after the read and rotate, so -page won't work. It will apply to all images, so you need to do it within the parentheses. Now you shouldn't need that extra -flatten.

Re: Laying out an aceo or wallet sheet

Posted: 2013-06-21T10:48:36-07:00
by holden
Big thanks GreenKoopa, that worked like a charm- here is the code (windows version) if anyone needs it for future reference

Code: Select all

convert -size 2400x3000 xc:white ^
( -repage +39+36 fighter.jpg ) ^
( -repage +824+36 fighter.jpg ) ^
( -repage +1611+36 fighter.jpg ) ^
( -repage +39+1124 fighter.jpg ) ^
( -repage +824+1124 fighter.jpg ) ^
( -repage +1611+1124 fighter.jpg ) ^
( -rotate 90 -repage +131+2208 fighter.jpg ) ^
( -rotate 90 -repage +1216+2208 fighter.jpg ) ^
-layers flatten compo.jpg
*actually, just another question that may be best answered in a new thread- is there a way to temporarily store an image? If I need to perform crop/scale operations on an image, then use it in the above code, then dump the temp image keeping only the comp, is that possible?

Re: [Solved] Laying out an aceo or wallet sheet

Posted: 2013-06-21T11:17:34-07:00
by GreenKoopa
mpr:
http://www.imagemagick.org/Usage/files/#mpr

-clone
http://www.imagemagick.org/Usage/basics/#clone

These may affect your use of -page. Best to do your -repage after the image is recalled.

Re: [Solved] Laying out an aceo or wallet sheet

Posted: 2013-06-21T11:19:12-07:00
by snibgo
In your command, you should put operations like "-repage" and "-rotate" after the input filenames, not before.

"-write mpr:AnyName" will save the image in memory, so anywhere later in the same command you can use "AnyName" (no quotes) where you could put a file name.

Re: [Solved] Laying out an aceo or wallet sheet

Posted: 2013-06-21T11:38:29-07:00
by holden
In your command, you should put operations like "-repage" and "-rotate" after the input filenames, not before.
I was taking syntax from here, is this page outdated?
http://www.imagemagick.org/Usage/layers/

Anyhow, thanks for the prompt replies as usual!

Re: [Solved] Laying out an aceo or wallet sheet

Posted: 2013-06-21T11:47:56-07:00
by GreenKoopa
It's possibly outdated. Where specifically?

It can be confusing at first. Settings can, and sometimes must, come before the image. -page, -size, and -gravity are settings. Operations go after the image(s) they are to operate on. -repage, -rotate, and -layers are operations.