[Solved] Laying out an aceo or wallet sheet

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?".
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

[Solved] Laying out an aceo or wallet sheet

Post 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
Last edited by holden on 2013-06-21T10:49:18-07:00, edited 1 time in total.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Laying out an aceo or wallet sheet

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Laying out an aceo or wallet sheet

Post by snibgo »

For repeating the same image without re-reading it, see also http://www.imagemagick.org/script/comma ... .php#clone
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Laying out an aceo or wallet sheet

Post 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
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Laying out an aceo or wallet sheet

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Laying out an aceo or wallet sheet

Post 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
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Laying out an aceo or wallet sheet

Post 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
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Laying out an aceo or wallet sheet

Post by GreenKoopa »

Spaces are required on each side of the parentheses. You are missing -page on the problematic line.
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Laying out an aceo or wallet sheet

Post 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.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Laying out an aceo or wallet sheet

Post 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.
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Laying out an aceo or wallet sheet

Post 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?
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

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

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

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

Post 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!
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

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

Post 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.
Post Reply