A
A
Andrey Sverlin2018-11-30 00:56:40
ImageMagick
Andrey Sverlin, 2018-11-30 00:56:40

How to merge many images in ImageMagick with a given step (negative)?

Hello.
There is a need to glue the map from the screenshots. Screenshots were made with an overlay. So? each next fragment should be offset by -200px relative to the right border of the previous one, and 100px down from the top (because we have a diamond-shaped map). Those. it turns out such a diagonal row from left to right / down. There are 301 images in a row. There are 101 such rows. A total of 30401 images. Each next row starts over the previous one. File numbering starts from the left corner of this diamond.
I implemented such an overlay in JavaScript and am still tinkering with code optimization. Because it is problematic to load such a volume with a browser, just as it is problematic to process such a script. As a result, I thought about all sorts of map APIs, but they all require one large glued image.
None of the programs for gluing panoramas helped me. I need a gluing with a given offset. One hope for ImageMagick, because it seems to me that it’s really possible to somehow repeat the script that I wrote in JS. But I learned about this program just yesterday and I have no idea how to implement what I need. So far, I've managed to just glue a few pictures in a row, but that's not it.
How it should look like in the end, you can see here - lss.format23.ru
I would be very grateful if you could tell me how to write such a command for ImageMagick.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Moskus, 2018-11-30
@Moskus

The task is rather complicated by the fact that your screenshot scheme does not have a rectangular, but an inclined grid. But judging by what I see in your example, the vertical rows are straight, that is, the vertical offset between two adjacent tiles is only vertical.
I would go the following way:
- I would crop the images until the overlap is eliminated (shave, gravity www.imagemagick.org/Usage/crop )
- I would glue the resulting tiles (montage) into vertical stripes
- I would sequentially merge the vertical stripes horizontally, adding each time one vertical strip on the right, so as not to fool around with the offset.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question