php & bash = unrecognized option `-brightness-contrast'

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
pet
Posts: 13
Joined: 2013-08-13T10:11:30-07:00
Authentication code: 6789
Location: Switzerland

php & bash = unrecognized option `-brightness-contrast'

Post by pet »

hello,

when i start a php exec a bash script with a 'convert IM script',
i get the error message:

" convert: unrecognized option `-brightness-contrast' @ convert.c/ConvertImageCommand/791."

but:
i can start directly the bash-shell test.sh without any errors
i can start a php script with directly exec. convert without errors
and !! a crop or other functions run without errors
only with 'brightness-contrast' in a background started shell-script get errors

My simple scripts:

##################################################################
start.php (with errors)

<?
exec("sudo -s nohup test.sh > /dev/null 2> /dev/null & echo $!") ;
echo "end convert ..."
?>

##################################################################

test.sh
#!/bin/sh

convert a.jpg -brightness-contrast 5x10 b.jpg ## with errors
convert a.jpg -crop 200x100+0+0 c.jpg ## without errors

exit

##################################################################

start.php (without errors)
<?
exec("sudo -s convert a.jpg -brightness-contrast 5x10 b.jpg ") ;
?>

##################################################################



My system:
centos 6 2.6.32-279.22.1.el6.x86_64
Version: ImageMagick 6.8.3-1 2013-02-21 Q16

Can anybody help me?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: php & bash = unrecognized option `-brightness-contrast'

Post by fmw42 »

Are you sure you do not have multiple version of IM installed and an older version is being used for which it predated -brightness-contrast?

Put the path to where IM resides into your command. Typically it will be /usr/bin or /usr/local/bin.

try

/usr/bin/convert -version

and

/usr/local/bin/convert -version

and see which is using the version you believe is what you have.
pet
Posts: 13
Joined: 2013-08-13T10:11:30-07:00
Authentication code: 6789
Location: Switzerland

Re: php & bash = unrecognized option `-brightness-contrast'

Post by pet »

was exactly the problem :D
a multiple version of IM
made a symlink to the wrong /bin path and now all work fine
thanks a lot
Post Reply