Search code examples
batch-filecmdimagemagickdosmontage

Is there a running time limitation?


I am running the DOS batch file below. My OS is Windows 7 with 3 GB ram. In Windows Explorer, I double-click the batch file and it runs fine with standard size images and combines the images into a larger image. When I do everything exactly the same except with larger .jpg image files that are 1 MB, the code runs but produces a zero-byte file. Could the batch file be timing out? Do you think this is a limitation with DOS or ImageMagick?

SETLOCAL EnableDelayedExpansion
SET MONTAGE="C:\Program Files\ImageMagick\Montage"
...
%MONTAGE% *.jpg -geometry +0+0 -tile 4x1 rows56-59-cols-32261-32400combined.jpg

Solution

  • ImageMagick itself can support exa-pixel images on a 64-bit OS, see the specification here. Unfortunately, JPEG cannot support images over around 64,000 pixels on either side.

    One solution might be to use a different outout format which does support larger images and ImageMagick will just quietly convert to that format for you. For example, PNG format uses 4 bytes for the width and height, so it should support up to around 4,000,000,000 pixels on either side. So you would do

    montage *.jpg ... output.png
    

    Note:

    A PNG image may compress better or worse than the corresponding JPEG file depending on whether it is a computer-generated graphics type of image (good for PNG) or a conventional photograph type of image as shot by a camera (good for JPEG). But it you want the bigger images, you may be stuck with PNG anyway. There is also a Large TIFF format that you could investigate.