Sorry but I'm new to all of this!
Using Powershell I can find if PDF pages have colour using:
$colour = convert "$PDF" -colorspace HSL -channel G -separate -format %[fx:mean] info:
echo $colour
0 = B/W
>0 = colour
All is well.
I want to do this on my hosted website using PHP but don't know how!
Thanks in advance.
Confused with PHP
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Confused with PHP
I don't do PHP, but the IM PHP forum viewforum.php?f=10 has plenty of examples to get you started. The "exec()" method seems to be easiest.
snibgo's IM pages: im.snibgo.com
Re: Confused with PHP
Thank you. To get a clearer idea I am using
exec('/usr/bin/convert "logo1.bmp" -colorspace HSL -channel G -separate -thumbnail 200x200 -format %[fx:mean] info: ');
I cannot get the 'info' bit returned. I have already looked through the area you mentioned but could not find anything?
exec('/usr/bin/convert "logo1.bmp" -colorspace HSL -channel G -separate -thumbnail 200x200 -format %[fx:mean] info: ');
I cannot get the 'info' bit returned. I have already looked through the area you mentioned but could not find anything?
Re: Confused with PHP
Ok, got it!
exec('/usr/bin/convert "logogrey.bmp" -colorspace HSL -channel G -separate -format %[fx:mean] info:',$return_info );
echo $return_info[0];
It was the [0] bit as it;s an array being returned.
exec('/usr/bin/convert "logogrey.bmp" -colorspace HSL -channel G -separate -format %[fx:mean] info:',$return_info );
echo $return_info[0];
It was the [0] bit as it;s an array being returned.
Re: Confused with PHP
An alternate method:
Code: Select all
$colour = exec('/usr/bin/convert "logogrey.bmp" -colorspace HSL -channel G -separate -format %[fx:mean] info:' );