Question

I'w writing a PHP script that uses Montage, which is an extension of ImageMagick that creates tiled arrays of images. The Montage syntax is straightforward:

montage image1.png image2.png image3.png -tile x1 -geometry 50x50 out.png

However, I'm generating these images on the fly and I would hate to have to write them to disk just to run this command. Is there some way I can pass there resources in without writing them to file?

(This isn't really a Montage question, but rather a general question that could apply to many different situations.)

Any help would be great!

Was it helpful?

Solution

As I commented, you could find some tmpfs file system (e.g. with df | grep tmpfs) such as /run and put your files inside. They will then live within the virtual memory (and won't usually need any disk I/O). Of course the space they take are consuming virtual memory resources (so are limited).

BTW, on many Linux systems, writing small files don't use a lot of disk I/O because they sit in the file system cache.

Of course, any tmpfs file system loses all its content at every reboot, so you don't want to keep important unrecoverable data inside.

OTHER TIPS

ImageMagick has APIs for both C and PHP. PHP IMagick appears to have montage hooks.

http://us3.php.net/manual/en/imagick.montageimage.php

General info on PHP IMagick usage: http://us3.php.net/manual/en/imagick.examples-1.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top