Page 1 of 1

complex commands working butsome simple options not working

Posted: 2011-03-18T21:16:13-07:00
by javismiles
dear friends, after moving to linux, things much better now, most of the complex commands are working now from php,
but the puzzling thing, some very simple options in commands are not working, maybe you can help me :)

so all these commands worked in windows perfect, but in linux they only work if we remove the following in 5 of them:

in one of them removing
-alpha opaque

in another removing
-auto-level

in another removing
-clut

in another the problem is
-hald-clut

in another finally, the colorspace seems to do something strange
its a command to make an image black and white using
-channel R -evaluate multiply 0.8 -channel G -evaluate multiply 0.1 -channel B -evaluate multiply 0.1
this worked great in windows to make the image black and white, but in linux the image stays in color and gets crazy :)


so all these, why is this, is this because a library is missing, i dont think so these seem to execute in the bash, not in php, so is it a syntax problem but its so simple
what could it be? i guess something is missing in the installation? i dont know
how can something as simple as -auto-level not be accepted
mmm

the puzzling thing is that very complex commands are working from php no problems,
very complex ones using the most complex things from vignette to sigmoidal contrast and more, lots of things, its just that these specific things are not working
-alpha opaque
-auto-level
-clut
-hald-clut
-channel to make black and white image

in all those 5 cases, i was removing thing by thing until i found which part was crashing the command and thats why i found it was those 5 things i have mentioned above

why do you think thats not working, do those need a different syntax in linux?

thank u :)
jav

Re: complex commands working butsome simple options not work

Posted: 2011-03-18T21:29:42-07:00
by javismiles
i thought it was some library missing but its not, i just tried the following clut command from the bash, and it worked and i checked the files and all great the result

but it fails from php, some syntax must be, what do you think?

convert ex1.jpg cluttest2.jpg -clut +sigmoidal-contrast 3x80% -blur 1,0.5 -quality 70 showme.jpg

thank u so much
jav

Re: complex commands working butsome simple options not work

Posted: 2011-03-18T21:32:42-07:00
by javismiles
same issue with

-auto-level
-alpha opaque
and the others

they do well from the bash
but not from php

do they need different syntax in linux from php?

Re: complex commands working butsome simple options not work

Posted: 2011-03-18T21:40:33-07:00
by anthony
javismiles wrote:do they need different syntax in linux from php?
Nope. BUT from your other discussions you may not be adding spaces correctly!

Re: complex commands working butsome simple options not work

Posted: 2011-03-18T21:44:17-07:00
by javismiles
ok this is beyond everything...
i reduced it to the simplest thing
see this command

convert ex1.jpg cluttest2.jpg -clut result.jpg

it executes perfect on the bash linux, perfect, perfect result

and from php? nothing, zero

how is possible, it cannot be a syntax issue, its so simple
convert ex1.jpg cluttest2.jpg -clut result.jpg

and the amazing thing is that much more complex commands are executing great from php,
so executing from php works great

but then some super simple things like
convert ex1.jpg cluttest2.jpg -clut result.jpg
dont work from php, but they do from the bash! crazy

Re: complex commands working butsome simple options not work

Posted: 2011-03-18T21:46:31-07:00
by javismiles
i wish it was spacing, i really wish
but it can hardly be spacing on this comman

"convert ex1.jpg cluttest2.jpg -clut result.jpg"

it executes perfect from bash
nothing from php

Re: complex commands working butsome simple options not work

Posted: 2011-03-18T22:33:01-07:00
by javismiles
i have news

i executed a convert -version > tmp
from php and from bash
and the result shows that php and the bash are accessing different versions, so there are 2 versions of imagemagick installed
now i need to delete the old one, any idea how to do that? do u think once i delete the old one php will pick the new one?

these are the versions :

diff tmp tmp2
1,3c1,2
< Version: ImageMagick 6.6.8-5 2011-03-18 Q16 http://www.imagemagick.org
< Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
< Features: OpenMP
---
> Version: ImageMagick 6.2.8 10/20/10 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
> Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
javismiles


we need to uninstall the old imagemagick version and keep the new one,
how do we know where is the Path where the system chooses where imagemagick is located
how do we set the path?
thank u

Re: complex commands working butsome simple options not work

Posted: 2011-03-18T22:39:07-07:00
by javismiles
the PATH of the bash
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
contains the path to the good newest imagemagick
thats why bash commands execute all perfect

for some reason PHP is not finding the path to the newest imagemagick, instead it finds the old installations of imagemagick
how can we change the path for the php to find the latest already installed version that bash is accessing?

thank u

Re: complex commands working butsome simple options not work

Posted: 2011-03-19T00:52:33-07:00
by anthony
javismiles wrote:ok this is beyond everything...
i reduced it to the simplest thing
see this command

convert ex1.jpg cluttest2.jpg -clut result.jpg

it executes perfect on the bash linux, perfect, perfect result

and from php? nothing, zero
Is the directory writable by the PHP user. Or perhaps you have SELinux anabled which further prevents public web programs from doing things they shouldn't.

Try

Code: Select all

convert  ex1.jpg cluttest2.jpg -clut  /tmp/result.jpg 
The "/tmp" directory should be writeable by anyone, but only the creator of a file can rename or delete the file.

You may like to read up on UNIX permissions which is much more versatile than the simple 'write anywhere' windows permissions. There are lots of UNIX beginners guides on the web.

Re: complex commands working butsome simple options not work

Posted: 2011-03-19T01:00:40-07:00
by anthony
javismiles wrote:we need to uninstall the old imagemagick version and keep the new one,
How did you install the second one? If the second was installed using RPM's that would not have happened!

Your can delete the system one (forcably) using
rpm -e --nodeps ImageMagick ImageMagick-perl

But you really should install the new one as a RPM.

how do we know where is the Path where the system chooses where imagemagick is located
how do we set the path?

Code: Select all

locate -r '/convert$'
will let you know where 'convert' commands are located
while

Code: Select all

type convert
will tell you the first one on the PATH.


With two installed one may not work right unless BOTH the PATH and LD_LIBRARY_PATH are configured right.
That is you really need to make sure that whichever IM is run, the same set of libraries is also used, otherwise you are going to get segmentation faults (unexpected program crashes - very bad).

That is not to say you can not have two or more versions of IM's installed, but you need to ensure they remain well separated. One method I use to let me have a normal system (rpm installed) ImageMagick and a personal (HDRI floating point) ImageMagick installed simultaneously is shown in IM Examples, API.
http://www.imagemagick.org/Usage/api/#personal