Best way to create a collage (in Java)

5.2k views Asked by At

I want to create a collage of photos. Similar to this image (think of photos instead of those colored rectangles):

Collage

The collage should be constructed from the following information.

We have a 2d map of slots and set of images. The map (in this case 3x3 slots) looks like this:

| s1 | s2 | s3 |
| s4 | s5 | s6 |
| s7 | s8 | s9 |

Now, for each image we know to which slot it belongs. Also, it might be the case that no image belongs to a particular slot; however, more than one image can belong to one particular slot (we might have more than 9 images).

In addition to this, if more than one image belong to a particular slot, we know to which degrees the images belong to that slot.

So, what would be the best way to create a collage (in Java) that looks beautiful but still preserves the structure of the above map?

(To get this 2d map we are using a Kohonen map)

1

There are 1 answers

0
Shaun Wild On

You could have a value (xa) that +='s the width of the image which is drawn onto the canvas everytime, and then set the next image x position relative to xa, then use modulus on that value constantly, but then use division to work out the Y value of the next image (xa / pageWidth). This was improvised, i apologise if it doesn't make sense.