0

I have a list of 25 TIF images (map tiles), each around 400 MiB in size (each small rectangle here):

enter image description here

I need to stitch them into one single huge TIF. Is there a command under Linux that can do this? I can provide absolute X/Y coordinates for every tile.

I tried it with the montage command (part of Imagemagick), but it seems to support only tilesets where each row / column has the same number of tiles.

1 Answers1

1

Is there a command under Linux that can do this?

I personally am not aware of a single command to do what you want.

I tried it with the montage command (part of Imagemagick), but it seems to support only tilesets where each row / column has the same number of tiles.

I don't know if this would be a solution for you, but you could (theoretically) generate the missing images beforehand, then simply include them in the montage command.

For your example image, assuming you had e.g. slice_1_1.tif to slice_1_6.tif for the first row, slice_2_1.tif to slice_2_6.tif for the second row, etc., you could generate "blank" images with something like the following:

magick -size 120x85 canvas:white slice_1_1.tif
magick -size 70x85 canvas:white slice_1_6.tif
magick -size 70x85 canvas:white slice_2_6.tif
magick -size 120x85 canvas:white slice_5_5.tif
magick -size 70x85 canvas:white slice_5_6.tif

You would, of course, need to use the correct sizes for your actual images. You could then run montage as normal:

magick montage *.tif -tile 6x5 -geometry +0+0 example.tif

which would give you something like:

Example TIF

Assuming there weren't any other considerations, I think the toughest part here would (potentially) be automating the "missing" image generation (assuming you needed to do that for some reason).


ImageMagick References

Anaksunaman
  • 18,227