Combine Satellite images in to a large file

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
dpluigi
Posts: 4
Joined: 2011-01-03T21:22:07-07:00
Authentication code: 8675308
Location: Las Vegas, NV, USA

Combine Satellite images in to a large file

Post by dpluigi »

Hi,

I have downloaded satellite image from Google Map for my personal use. The satellite image was saved as combination of tiles. The tiles covering my area of interest were saved in directories labeled 000, 001, ... through 255. Each sub-directories contain 256x256 pixels images, each named sequentially 1x000000.jpg through 1x000255.jpg for subdirectory labelled 000; and 1x255064.jpg through 1x255255.jpg for subdirectory 255.

This represent a large amount of tiles that I would like to recombine into one large image composed of 256x256 images, each 256x256 pixels. I came across imagemagik and the included Perlmagickthat I installed on my Windows 7 using the 64bit (inc. dll libraries) binary ImageMagick-6.6.6-10-Q16-windows-x64-dll.exe .

I have very little experience with perl and new to imagemagik. I would appreciate if someone could suggest a script a method which process all the files contained in each folders and combine then into a large image.

I apologize in advance if there is a post answering my question but I did not find one using the search tool in the list.

Thank you in advance for your suggestions and happy new year 2011.

Donat-Pierre
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine Satellite images in to a large file

Post by fmw42 »

Are your subdirectories different resolution tiles. That is each subdirectory should be the same image if combined but at different scales. If so, then you only need one subdirectory of tiles at the resolution you desire. However, if you have too many tiles, then any process will use too much memory to hold all the tiles and so will slow down drastically as IM will use disk rather than memory. If you can use all the tiles in one directory and not too much memory, then see montage at http://www.imagemagick.org/Usage/montage/. This is for command line or can also be done using PHP and the exec function.

However, I don't know how you would do this in IMagick or Perl. The post you have made is to the IMagick group which is for PHP and not PerlMagick. See the group on PerlMagick at viewforum.php?f=7
dpluigi
Posts: 4
Joined: 2011-01-03T21:22:07-07:00
Authentication code: 8675308
Location: Las Vegas, NV, USA

Re: Combine Satellite images in to a large file

Post by dpluigi »

The image files in each sub-directories have the exact same resolution. I saw the Montage command but wondered how can this command or a script using this command can scan over each folder in turn/sequentially in the right order. The order should be easily to follow since the naming convention would order the file appropriately.

I wrote this post for both Imagemagick and PerlMagick communities.

Shall I re post to the PerlMagick forum or can my post be moved to the PerlMagick forum?

Thank you for the reply and suggestion.

Donat
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine Satellite images in to a large file

Post by fmw42 »

Montage cannot work across directories to my knowledge. But why do you need to do that. Just pick one resolution and use all the images in that directory. The only format that would be a pyramid structure is PTIF, but it starts with a high resolution and creates and stores all the lower resolutions in tile format depending upon the tile size you specify.

I cannot move this topic. It would be best for you to post to the Perlmagick forum and link back to this topic here or just copy and paste your original in the PerlMagick forum.
dpluigi
Posts: 4
Joined: 2011-01-03T21:22:07-07:00
Authentication code: 8675308
Location: Las Vegas, NV, USA

Re: Combine Satellite images in to a large file

Post by dpluigi »

Hi,

The sub-directory structure I described was set by the downloading Satellite image application to organize the large amount of tile files and is not related to resolution.
All these files are at the same resolution and would result in one image at one scale ratio.

Actually, all these sub-directories are within a directory labeled 1x, which corresponds to the resolution I selected (high resolution).

I could move all these files from the 256 sub-directories up to the parent directory (i.e. 1x) if it helps...

I did repost this post to the PerlMagick forum but did not get any reply or suggestions yet. Thank you for your inputs.

Donat-Pierre
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine Satellite images in to a large file

Post by fmw42 »

Thanks for the clarification. It sounds to me like you have an great amount of data. I am not clear on the naming conventions, but you will likely have to write a custom script based upon +-append (see http://www.imagemagick.org/Usage/layers/#append), unless you put them all in one directory and the naming conventions puts the images in row order that montage requires (see http://www.imagemagick.org/Usage/montage/). However, I suspect that you have way too much image data to process effectively as IM will work best if it all can be held in memory at one time. You should calculate the total size of all your tiles and see if you have enough memory to hold them. Otherwise, IM will process much slower as it will have to access disk in place of memory. There are parameter to help, but it will still be slow and I am not an expert on these settings. see http://www.imagemagick.org/Usage/files/#massive
Post Reply