Hello Everyone!
Many thanks for the ImageMagick!
I'd like to know whether it is possible to combine multiple images of different sizes while optimizing the placement?
Say, there are some colored rectangles which represent images of different size
Now, I want to combine those into one image.
Here is what montage does:
Considering white is a background, is it possible to optimize placement of the colored rectangles?
I.e. one can clearly see that there's enough space to move up both cyan and magenta rectangles.
Then the gray one might go all the way to the right and the black one either to the right or up.
The tricky part is that there might be several large rectangles which will combine with huge "spaces" in-between.
Is there any chance that ImageMagick will search such "holes" and "place" the rectangle currently being added to the image into one of those "holes" if there's enough "room" (i.e. some "hole" is bigger than the current rectangle)?
[SOLVED] Combining images: How to optimize image placement?
[SOLVED] Combining images: How to optimize image placement?
Last edited by 4aiman on 2016-08-03T22:56:41-07:00, edited 2 times in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Cmbining images: How to optimize image placement?
One thought is to order your images by size, largest first. Place the first image at the top left. Then search for the largest empty space and place the next largest image. Etc.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Cmbining images: How to optimize image placement?
A useful "Survey on two-dimensional packing": http://cgi.csc.liv.ac.uk/~epa/surveyhtml.html
snibgo's IM pages: im.snibgo.com
Re: Combining images: How to optimize image placement?
Thanks. snibgo!
The survey you've linked to is very useful
Marking this as "solved".
The survey you've linked to is very useful
Marking this as "solved".
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [SOLVED] Combining images: How to optimize image placement?
Did you implement one of those methods? If so, your code could be useful to others.