Page 1 of 1

Collage with individual sizes and pos. from the same image

Posted: 2012-04-10T01:11:59-07:00
by cooper64
Hallo,

what I have is one source image and 3x geometry data to position the image three times on different places and sizes in a white background. Target image should have a size of 500x500px.
Example geometry data:
167x251+166+25
126x187+124+292
249x292+126+187

What I need is that:
Image

Is it possible to create that in one command-line? Or it is only possible to realize that with multiple commands? (I am interested in a minimum of calculation time)
I think, montage in combination with -tile is not working for me.

Additional rotate question:

Is it also possible in the same step, to rotate some of the pictures?
Like this:
Image

I need your help, in the tutorials i've not found a solution.
Thanks.

cooper64

cooper

Re: Collage with individual sizes and pos. from the same ima

Posted: 2012-04-10T10:07:49-07:00
by fmw42
please provide a clean separate copy of your input image. then I think we can give you the command(s)

or see

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

and use parenthesis processing with clones to shrink and/or rotate your image

see

http://www.imagemagick.org/Usage/basics/#parenthesis

Re: Collage with individual sizes and pos. from the same ima

Posted: 2012-04-10T22:45:16-07:00
by anthony
It is straight forward.

Code: Select all

   convert  {image} -rotate -90\> -background white -gravity center \
                \( +clone -resize 50% 
                   -duplicate 1 +append \) \
                -append   {result}
the -rotate -90\> ensures the image is in landscape

Here is your second request...

Code: Select all

   convert  {image} -rotate -90\> -background white -gravity center \
                \( +clone -resize 50% \
                   \( +clone -resize 50% -rotate -90 \
                     -duplicate 1 -append \) \
                   +append \) \
                -append   {result}
Can you see the expansion of the code? Follow that and you can make N images each hafl the size of the other.

If you are on windows, see Windows DOS scripting
http://www.imagemagick.org/Usage/windows/#dos

Re: Collage with individual sizes and pos. from the same ima

Posted: 2012-04-10T22:51:50-07:00
by anthony
If you want the images to fit to printed paper. Then the image should be padded out to a specific ratio.
That is is size is a ratio of 1:sqrt(2)

The metric paper system uses that system
A0 = 1 square meter in this ratio 841mm X 1189mm
half A0 => A1 whcih also has the same ratio
half A1 => A2
etc until you get the popular sizes A4 and A5

By that logic A4 is 1/(2^4) or 1/16 meters square.
This is the size you will probbaly be wanting to re-create as that is printing sizes.

So the next question... How to pad out an image to this ratio?
(or better still to any specified ratio?)

Of course the -resize in this arrangement is NOT 50%.... but needs to be resize by the same ratio.
That is 1/sqrt(2) or -resize 70.71% which with rotation should allow two images to fit exactly against, or even into the larger image.

So if your initial image is A5 in size. the next two 70.71% smaller image appeneded to one size will produce a A4 printing page.
Or you can fit on a A4 page: a 1 x A5, and 2 x A6 images, or an A5, A6 and 2 A7 images ;-)
that is the beauty of the metric paper system
http://en.wikipedia.org/wiki/ISO_216

Re: Collage with individual sizes and pos. from the same ima

Posted: 2012-04-10T23:30:34-07:00
by anthony
Taking this further.

If your original figure has a aspect ratio of W:H
And you want two rotated images to fit the longer size (say 'W')
You can make use of the bounding box argument of resize, in which case
rotate the image 90 degrees, and resize it to fit a (W/2)x(W/2) pixel box.

Assuming the W dimention is a multiple of 2,
unless you want to get into sub-pixel resizing using distorts :-) Which is not recommended for this!

Re: Collage with individual sizes and pos. from the same ima

Posted: 2012-04-11T16:48:22-07:00
by anthony
I wish to point out, as it was pointed out to me (Thanks Fred)
1:sqrt(2) is not a golden ratio. It is the Lichtenberg Ratio
I really should read my own references more fully :-)
I'll fix my previous posts.

Re: Collage with individual sizes and pos. from the same ima

Posted: 2012-04-11T17:54:47-07:00
by fmw42
anthony wrote:It is the Lichtenberg Ratio
Interesting, I had never heard of that one. Looking it up. see http://en.wikipedia.org/wiki/Lichtenberg_ratio#History

Re: Collage with individual sizes and pos. from the same ima

Posted: 2012-04-11T23:56:36-07:00
by cooper64
Thank you for your support.

My image sizes are not always 50% of the source image. Rather, they are different combinations of photo standard formats - like (13x18, 9x13, 6x9, or passport photo).
But the displayed result image must not be exact in the proportions.

So I think your command example will work for me, I will try it.

Yet once again my question: Would it also work with the specification of coordinates? (like {image} -geometry 195x284+163+18 ( +clone -resize 50% -geometry 107x155+149+305...)

The background is:
The user wants to create their own combinations of image sets. I can explain to him the using of coordinates, but not the using of ImageMagick commands :)

And a small question to your example: Is it possible to set the white background to a fix size (e.g. 500x500px)?

Thanks for your support. I work for the first time a little more intense with ImageMagick. It's really amazing what this tool can realize!

cooper

Re: Collage with individual sizes and pos. from the same ima

Posted: 2012-04-12T00:05:10-07:00
by anthony
Do not use a size in the -geometry option
The geometry offset is used later in a low level -composition. which you don't seem to use.

An alturnative is to set a 'page' or 'virtual canvas' offset. This us used for 'layering' images.

For example of may different ways of 'laying out' images in a completely user controled way, see
IM examples, Layering Multiple Images
http://www.imagemagick.org/Usage/layers/

It starts with append, works though multiple two image compose methods, to multi-image layering methods and finally finishes up with programmed layout methods.

More formal layout methods are planned for late IMv7 development.