ImageMagick

From Servage Wiki
Jump to: navigation, search

Contents

What is the path to ImageMagick?

Here are paths for other ImageMagick binaries:

/usr/bin/animate
/usr/bin/compare
/usr/bin/composite
/usr/bin/conjure
/usr/bin/convert
/usr/bin/identify
/usr/bin/mogrify
/usr/bin/montage
/usr/bin/stream

What is the path to ImageMagick Convert utility?

The path for ImageMagick Convert utility is:

/usr/bin/convert

Why do I receive an ImageMagick permissions error message?

If you receive the following error message: "The installer can not find the '/usr/local/bin/convert/' directory you have specified for ImageMagick or it does not have permission to access it. Check that your typing is correct and that you have access to the specified directory."

The path should be added in a script. The correct folder for ImageMagick Convert utility is:

/usr/bin

The path /usr/bin/convert is the path to the binary file.

How do I use ImageMagick in PHP?

Here is an example of how to use ImageMagick in PHP:

<?php
$cmd = '/usr/bin/convert -thumbnail 100x42 "test.jpg" "test.gif"';
exec($cmd);
?>

This will create a thumbnail of test.jpg called test.gif with the dimensions 100x42 pixels.

Or an example which creates a monochrome image (black / white) out of an already existing image:

<?php
$cmd = '/usr/bin/convert "test.jpg" -monochrome "test.gif"';
exec($cmd);
?>

Please note that the file test.jpg is in the same directory as the PHP file is and the file test.gif will be generated also in the same directory.

Personal tools
Navigation