Identify Command with Binary Data ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
nomaam

Identify Command with Binary Data ?

Post by nomaam »

Hello:

I am working on Debian with PHP5 and ImageMagick.

I have a web application where a user submits an image through a form and then the image is re-sized several times. I am able to use the identify command to obtain the original image details as it is written to a temporary file for processing. However, when I convert the main image to other sizes the images will be inserted directly to a MySQL database in a blob field.

I would like to obtain the converted image properties using the identify command. However, I do not want to write each of the converted images to disk solely to obtain the image properties as it would be very slow.

How can I use the identify command in the following manner?

$commandIM = "identify -format '%w %h %b %x %m' {$variable-with-image-binary-data}";
exec ($commandIM, $output);
$info = explode(' ',$output[0]);

From what I have read the identify command can only be used with a file path name... but there must be another way as writing all the files to disk just to obtain the file details and then deleting them would not be efficient by any means.

Thank you.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Identify Command with Binary Data ?

Post by magick »

We suspect that Imagick, the PHP ImageMagick wrapper, provides a identify call that accepts a blob (i.e. a in-memory image format). That is your most promising path forward.

Can you write the image to a shared memory segment? If so, we could add shared memory support to the ImageMagick command lines to resolve this problem.
nomaam

Re: Identify Command with Binary Data ?

Post by nomaam »

I do not know how to write an image to a shared memory segment. Is this function possible through other means such as the GD library or a PHP feature?
Post Reply