Hello guys, i'm trying to merge together a lot of satellite img tiles into one.
At first i tried ''montage -mode concatenate'' but then realised they have been previously exported in a vertical manner,
so after looking around a bit i found a way to create vertical columns and then align them horizontally with another command.
The results seems a bit weird though.
By doing first this :''
''montage -mode concatenate -tile 1x(numb of images in a col) Tile_*.jpg cols.jpg''
i managed to get the exact number of images to fit in a column, then:
'' montage -mode concatenate -tile16x1 cols*.jpg merged.jpg ''
to obtain the final merged picture.
The issue is at STEP ONE when creating the cols there are few images not matching the vertical alignment (!?)
subsequently when i merge everything together those ones don't match up....
I also checked filenames and they are all correct!
find attached 'column' export example and 'merged' example.
https://drive.google.com/open?id=0BydA_ ... XJBU1ZsR0U - column example
https://drive.google.com/open?id=0BydA_ ... Dk5XzJHRms - merged result
I would be very grateful if anyone could help me sorting this out
Thanks
Merge Tiles Vertically, positioning issue
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Merge Tiles Vertically, positioning issue
This isn't much to go on. I can't see a problem in your images, but I don't know what I'm looking for. How far is the misalignment?matewfeel wrote:The issue is at STEP ONE when creating the cols there are few images not matching the vertical alignment (!?)
Are all your inputs the same size? What is different about the ones that don't align? Can you isolate the problem to a single pair of images?
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Merge Tiles Vertically, positioning issue
I do not see any horizontal offsets. But, I do see color changes or possibly tiles out of order. If the latter, are all your tile jpg images numbered and if so do you use leading zeros. If not leading zeros, most OS systems will list them alphabetically, not numerically, so that you have image-10 next to image-1.
Re: Merge Tiles Vertically, positioning issue
The tiles are named respectively 'Tile_0x0' 'Tile_0x1' 'Tile_0x2' 'Tile_0x3' to 'Tile_10x0' 'Tile_10x1' 'Tile_10x2' and so on....
i believe the problem here is as FMW42 mentions. no offsets but tiles are out of order. how would i do to make it list numerically correct ?
shall i add a '0'+its respective number in front of each eg '01Tile_0x1' ?
Thank you
i believe the problem here is as FMW42 mentions. no offsets but tiles are out of order. how would i do to make it list numerically correct ?
shall i add a '0'+its respective number in front of each eg '01Tile_0x1' ?
Thank you
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Merge Tiles Vertically, positioning issue
You could do that but you need to be sure that you number them in the order you need them. The problem is that XxY numbers are probably not sequential alphabetically. If you have many tiles, it may be tedious doing it manually. You might want to consider writing a script loop over you XxY indices to add the leading sequential number with leading zeros.
You would be better off making the filenames in sequential order in your script/program with leading zeros.
You would be better off making the filenames in sequential order in your script/program with leading zeros.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Merge Tiles Vertically, positioning issue
Even if you get the starting images in the correct order for the first command and save them as "cols.jpg", they will be output according to ImageMagick's default numbering scheme. A directory listing of those files may look something like this...
Code: Select all
01/27/2017 03:42 PM 7,052 cols-0.jpg
01/27/2017 03:42 PM 7,052 cols-1.jpg
01/27/2017 03:42 PM 7,052 cols-10.jpg
01/27/2017 03:42 PM 7,052 cols-11.jpg
01/27/2017 03:42 PM 7,052 cols-12.jpg
01/27/2017 03:42 PM 7,052 cols-13.jpg
01/27/2017 03:42 PM 7,052 cols-14.jpg
01/27/2017 03:42 PM 7,052 cols-15.jpg
01/27/2017 03:42 PM 7,052 cols-16.jpg
01/27/2017 03:42 PM 7,052 cols-17.jpg
01/27/2017 03:42 PM 7,052 cols-18.jpg
01/27/2017 03:42 PM 7,052 cols-19.jpg
01/27/2017 03:42 PM 7,052 cols-2.jpg
01/27/2017 03:42 PM 7,052 cols-20.jpg
01/27/2017 03:42 PM 7,052 cols-3.jpg
01/27/2017 03:42 PM 7,052 cols-4.jpg
...
Code: Select all
montage ... ... Tile_*.jpg cols%03d.jpg
Code: Select all
01/27/2017 03:52 PM 7,052 cols000.jpg
01/27/2017 03:52 PM 7,052 cols001.jpg
01/27/2017 03:52 PM 7,052 cols002.jpg
...
Also, unless space is an issue, you might consider saving your intermediate files in a format other than JPG. Using a lossless format like PNG would give you better results, especially for things like those very detailed map quadrants.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Merge Tiles Vertically, positioning issue
You can change the filenames so they are listed in the order you want. For a one-off or if used infrequently, you can do a directory listing of your filenames redirected to a text file, edit the text file so it has those names in the proper order, and use that text file as your list of inputs for "montage". Say for example your text file is named "myfiles.txt", prefix the filename with an "@" to make it happen.
Code: Select all
montage @myfiles.txt ... ...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Merge Tiles Vertically, positioning issue
Note if using @, you may have to modify your policy.xml to allow the use of @.