Page 1 of 2
linux command issue
Posted: 2011-03-18T19:33:50-07:00
by javismiles
hi my friends
i keep going through commands that used to work in windows and dont in linux now,
i have solved most of them, cant make this one, this one adds a shadow to the text, works in windows great, its failing in linux, any ideas why?
all this is from php
$command ='convert -background none -fill "'.$thecolor.'" -font '.$font_selection.' -pointsize '.$thesize.' -gravity '.$thealign.' label:"'.$thetext.'" ( -clone 0 -background black -shadow '.$valsh.' ) -compose DstOver -composite -compose Over -rotate '.$theangle.' '.$target_image.'';
thank u very much
jav
Re: linux command issue
Posted: 2011-03-18T19:40:41-07:00
by javismiles
this is a clearer example of the command from php in linux
convert -background none -fill "#457654" -font type/arial.ttf -pointsize 20 -gravity West label:"hola" ( -clone 0 -background black -shadow "100x1+2+2)") -compose DstOver -composite -compose Over -rotate 0 e2.png
this works perfect in windows, but not in linux from php
any ideas?
thank u
jav
Re: linux command issue
Posted: 2011-03-18T19:42:33-07:00
by javismiles
if i try it in the bash
[root@mediaserver site]# convert -background none -fill "#457654" -font type/arial/arial_normal.ttf -pointsize 20 -gravity West label:"hola" ( -clone 0 -background black -shadow "100x1+2+2") -compose DstOver -composite -compose Over -rotate 0 e2.png
-bash: syntax error near unexpected token `('
Re: linux command issue
Posted: 2011-03-18T19:45:12-07:00
by fmw42
In unix, you need to use \ to escape the parens \( .... \)
Also there must a space after the ( and before the )
Re: linux command issue
Posted: 2011-03-18T19:48:31-07:00
by javismiles
if i take the parenthesis away like this
convert -background none -fill "#457654" -font type/arial/arial_normal.ttf -pointsize 20 -gravity West label:"hola" -clone 0 -background black -shadow "100x1+2+2" -compose DstOver -composite -compose Over -rotate 0 e2555.png
then it executes and works but the result of course is wrong as it applies the shadow to the entire word and not to the edge
so the parenthesis are the problem, how do we keep the parenthesis in linux without the bash complaining?
Re: linux command issue
Posted: 2011-03-18T19:50:33-07:00
by javismiles
yes it works
putting the \ before the (
thank u!
)
Re: linux command issue
Posted: 2011-03-18T19:57:28-07:00
by javismiles
having similar problem with this one, i put \ in front of the ( but still not working,
i suspect the % signs maybe? what do u think
$command = 'convert '.$source_image.' -fill green -colorize 15% -alpha opaque -sigmoidal-contrast 4x15% -blur 1,0.5 \( +clone -fill white -colorize 100 -background "#cccccc" -vignette 0x35-30-30 \) -compose multiply -composite -quality 70 '.$target_image ;
Re: linux command issue
Posted: 2011-03-18T20:20:45-07:00
by javismiles
another one that fails and is very simple
$command = "convert ".$source_image." ".$clutimage." -clut ".$target_image ;
this works from the bash
but not from php
any ideas?
Re: linux command issue
Posted: 2011-03-18T20:32:50-07:00
by javismiles
ok in the first one i showed that doesnt work we have found out that it works if we remove
-alpha opaque
any ideas why?
it works from the bash with -alpha opaque
but from php we need to remove that to make it work, the -alpha opaque
any ideas?
Re: linux command issue
Posted: 2011-03-18T20:35:03-07:00
by javismiles
so in two of our commands
it seems that it doesnt like from php using
-alpha opaque
and also
-clut
any ideas?
Re: linux command issue
Posted: 2011-03-18T20:43:39-07:00
by javismiles
apart from
-alpha opaque
and
-clut
giving problems in linux
the other problem i have is this that im using to produce black and white image, in windows works great
-channel R -evaluate multiply .8 -channel G -evaluate multiply .1 -channel B -evaluate multiply .1 +channel -separate -compose add -flatten
but in linux it produces a red image very strange
Re: linux command issue
Posted: 2011-03-18T21:04:49-07:00
by javismiles
oki another problem
in another of the commands, it only works when we remove -auto-level
any ideas?
so all these commands worked in windows perfect, but in linux they only work if we remove
in one of them removing
-alpha opaque
in another removing
-auto-level
in another removing
-clut
why is this, is this because a library is missing, i dont think so because most of this execute in the bash, not in php, so is it a syntax problem but its so simple
what could it be?
Re: linux command issue
Posted: 2011-03-18T21:30:16-07:00
by anthony
javismiles wrote:having similar problem with this one, i put \ in front of the ( but still not working,
i suspect the % signs maybe? what do u think
$command = 'convert '.$source_image.' -fill green -colorize 15% -alpha opaque -sigmoidal-contrast 4x15% -blur 1,0.5 \( +clone -fill white -colorize 100 -background "#cccccc" -vignette 0x35-30-30 \) -compose multiply -composite -quality 70 '.$target_image ;
NOTE -colorize only takes a percent value, so the '%' flag is not used.
However % has no special meaning to either PHP or linux. so you do not have to double or escape them.
It is # < > ( ) [ ] { } ; & * and all quotes that have a special meaning for shells.
Re: linux command issue
Posted: 2011-03-18T21:35:49-07:00
by anthony
javismiles wrote:another one that fails and is very simple
$command = "convert ".$source_image." ".$clutimage." -clut ".$target_image ;
this works from the bash
but not from php
any ideas?
Actually you have removed all spaces between arguments in the command, so the shell sees...
convert sourceclut-cluttarget
Assuming $source_image = "source" etc...
The shell would pass that to the convert and convert would see only one long argument that does not make sense!
I really suggest you try to get a log of your PHP error returns!!!
See some rough notes I made about this, for another project
http://www.ict.griffith.edu.au/~anthony ... /php.hints
Re: linux command issue
Posted: 2011-03-18T21:38:54-07:00
by anthony
javismiles wrote:in another of the commands, it only works when we remove -auto-level
any ideas?
Sounds like your version of IM is older than the addition of these operators.
What does
convert -version say
Look at
convert -list command
and
convert -list alpha
etc...
To see what you can list using
convert -list list