A
A
Aleksandr Makarov2019-10-12 20:29:15
Python
Aleksandr Makarov, 2019-10-12 20:29:15

How to implement the layout of images into a single image?

Good day. I have a task to combine pictures (81 pieces) from a folder into a new image. I presented the new image in the form of a 9x9 matrix. The problem is that the matrix is ​​​​filled randomly, that is, the picture does not work. Who can tell me how to make sure that the images are correctly sorted (collected) into a new image.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
o5a, 2019-10-12
@o5a

It is difficult to advise without seeing the file format and how you actually collect the image. But if the question is how to split consecutive 81 files into a row / column, then you can do this. Let's say we're looping through our 81 sorted files. Then x,y will be:

for i in range(81):
  x, y = divmod(i, 9)

respectively (0.0), (0.1)...(0.8), (1.0) ... (1.8)...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question