Best way to create a collage (in Java)

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

Collage

A collage should be built from the following information.

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

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

Now for each image, we know which slot it belongs to. In addition, it may be that the image does not belong to a specific slot; however, more than one image may belong to one particular slot (we may have more than 9 images).

In addition to this, if more than one image belongs to a particular slot, we know to what extent the images belong to this slot.

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

(To get this 2d map, we use the Kohonen map)

+6
source share
1 answer

You can have a value (xa) that is + = width of the image that is drawn onto the canvas each time, and then set the next position of the image x relative to xa, and then use the module by that value all the time, but then use to generate the Y value of the next image (xa / pageWidth). It was improvised, I apologize if this makes no sense.

0
source

Source: https://habr.com/ru/post/916454/


All Articles