Fred's ImageMagick Scripts
Fred's ImageMagick Scripts
Hi Fred,
First of all, thanks a lot for sharing all helpful scripts for ImageMagic! I will have a question about 'embroidery effect'.
I uploaded the embroidery file into my server and ran the following bash and similar variations but always failed. It creates the effect but only gray color background but other colors on the CNBC logo. My IM version is 6.7 and tested some of other scripts you shared and worked.
COMMAND I USE:
bash /var/www/html/dashboard/embroidery -n 8 -p 1 -t 2 -i 0 -C 0 /var/www/html/uploads/cnbc.jpg /var/www/html/cnbc3.jpg
INPUT FILE: The input file I used here is the same you are using:
http://www.fmwconcepts.com/imagemagick/ ... s/cnbc.jpg
OUTPUT FILE:
http://52.25.162.129/cnbc3.jpg
Could you please tell me if I am missing something? Your help highly appreciated!
First of all, thanks a lot for sharing all helpful scripts for ImageMagic! I will have a question about 'embroidery effect'.
I uploaded the embroidery file into my server and ran the following bash and similar variations but always failed. It creates the effect but only gray color background but other colors on the CNBC logo. My IM version is 6.7 and tested some of other scripts you shared and worked.
COMMAND I USE:
bash /var/www/html/dashboard/embroidery -n 8 -p 1 -t 2 -i 0 -C 0 /var/www/html/uploads/cnbc.jpg /var/www/html/cnbc3.jpg
INPUT FILE: The input file I used here is the same you are using:
http://www.fmwconcepts.com/imagemagick/ ... s/cnbc.jpg
OUTPUT FILE:
http://52.25.162.129/cnbc3.jpg
Could you please tell me if I am missing something? Your help highly appreciated!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Fred's ImageMagick Scripts
There was a typo in my argument trapping. It worked fine with the defaults and no arguments specified, but failed when -p was specified. I have fixed that and uploaded a new script. Download that and let me know if that still fails. If so what is your exact version of IM from
convert -version
convert -version
-
- Posts: 13
- Joined: 2015-12-07T07:42:02-07:00
- Authentication code: 1151
Re: Fred's ImageMagick Scripts
I am also facing the problem with the embroidery image conversion. When I am trying to apply the embroidery effect, only background is converting into the embroidery and rest of the image part became the black. I am using the same cnbc image.http://www.fmwconcepts.com/imagemagick/ ... s/cnbc.jpg.
Please provide me the solution of this issue.
Please provide me the solution of this issue.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Fred's ImageMagick Scripts
What is your exact command line? What error messages? What is your version of IM and platform? On what web site is this being used? Did you upgrade the script after I fixed the -p argument as mentioned above?
-
- Posts: 13
- Joined: 2015-12-07T07:42:02-07:00
- Authentication code: 1151
Re: Fred's ImageMagick Scripts
I am using the below logic with the php.
<?php
$path_to_script= dirname(__FILE__)."/embroidery.sh";
exec("$path_to_script -n 8 -p 1 -t 2 -i 0 -C 0 cnbc.jpg cnbc_1.jpg");
exit;
?>
Platform : Linux
Imagemagick version : ImageMagick 6.9.0-3 Q16 x86_64 2015-01-09
I am using the latest embroidery script.
There is no any error message.
Only background converted into embroidery other than that all parts converted into black color.
<?php
$path_to_script= dirname(__FILE__)."/embroidery.sh";
exec("$path_to_script -n 8 -p 1 -t 2 -i 0 -C 0 cnbc.jpg cnbc_1.jpg");
exit;
?>
Platform : Linux
Imagemagick version : ImageMagick 6.9.0-3 Q16 x86_64 2015-01-09
I am using the latest embroidery script.
There is no any error message.
Only background converted into embroidery other than that all parts converted into black color.
-
- Posts: 13
- Joined: 2015-12-07T07:42:02-07:00
- Authentication code: 1151
Re: Fred's ImageMagick Scripts
I got below error with junk data. So I have posted error message here.
"sort: write failed: standard output: Broken pipe sort: write error"
"sort: write failed: standard output: Broken pipe sort: write error"
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Fred's ImageMagick Scripts
I do not understand your PHP syntax. Try this
<?php
exec("/fullpath2/embroidery -n 8 -p 1 -t 2 /fullpath2/cnbc.jpg /fullpath2/result.jpg 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
Do you get any error messages?
<?php
exec("/fullpath2/embroidery -n 8 -p 1 -t 2 /fullpath2/cnbc.jpg /fullpath2/result.jpg 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
Do you get any error messages?
-
- Posts: 13
- Joined: 2015-12-07T07:42:02-07:00
- Authentication code: 1151
Re: Fred's ImageMagick Scripts
Yes, We got the same error. Below is the error which we have found with your provided script.
Error:-
sort: write failed: standard output: Broken pipe
sort: write error
Below is the final output after applying the embroidery effect.
![Image](http://rightwaysolution.in/imagemagick/output.jpg)
Error:-
sort: write failed: standard output: Broken pipe
sort: write error
Below is the final output after applying the embroidery effect.
![Image](http://rightwaysolution.in/imagemagick/output.jpg)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Fred's ImageMagick Scripts
Do you have the unix command sort available?
What do you get from
or
I get
What web site is this for?
What do you get from
Code: Select all
convert cnbc.jpg -format "%c" histogram:info: |\
sort -k 1 -nr | head -n 8 | sed -n "s/^.*\(#.*\) .*$/\1/p"
Code: Select all
convert cnbc.jpg -format "%c" histogram:info: | sort -k 1 -nr | head -n 8 | sed -n "s/^.*\(#.*\) .*$/\1/p"
Code: Select all
#FFFFFF
#0A0B0D
#00A13A
#5C4F94
#0070B6
#F5AD00
#BA2342
#E36612
-
- Posts: 13
- Joined: 2015-12-07T07:42:02-07:00
- Authentication code: 1151
Re: Fred's ImageMagick Scripts
We found the same colors from the provided the script.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Fred's ImageMagick Scripts
Are you saying that the sort worked fine? If so, then I am at a loss to know why the script fails for you, esp, if you have modifed the PATH to include the path to convert.makwana.ajay wrote:We found the same colors from the provided the script.
Are you running the script where the images reside? If not, then you need the path to the images.exec("$path_to_script -n 8 -p 1 -t 2 -i 0 -C 0 cnbc.jpg cnbc_1.jpg");
try
Code: Select all
exec("bash $path_to_script -n 8 -p 1 -t 2 -i 0 -C 0 cnbc.jpg cnbc_1.jpg");
try editing the sort line in the script at 419/420 to be
Code: Select all
colorArr=(`convert $dir/tmpI.mpc -format "%c" histogram:info:- | sort -k 1 -nr | head -n $numcolors | sed -n "s/^.*\(#.*\) .*$/\1/p"`
Can you test in a terminal window (even on another computer) to see if that works? That will tell us if it is your PHP environment.
-
- Posts: 13
- Joined: 2015-12-07T07:42:02-07:00
- Authentication code: 1151
Re: Fred's ImageMagick Scripts
Hello,
Thank you for your prompt reply and solution. Now the solution works fine with the command prompt but still there is some issue when try to execute the script from the PHP.
Below are the some server configuration.
System :- Linux dnb.com 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64
Apache Version :- Apache/2.2.15 (CentOS)
PHP Version :- 5.3.3
Please look into that and help us to work it with php script.
Thanks a lot.
Thank you for your prompt reply and solution. Now the solution works fine with the command prompt but still there is some issue when try to execute the script from the PHP.
Below are the some server configuration.
System :- Linux dnb.com 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64
Apache Version :- Apache/2.2.15 (CentOS)
PHP Version :- 5.3.3
Please look into that and help us to work it with php script.
Thanks a lot.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Fred's ImageMagick Scripts
Sorry, but I do not know how to configure PHP.
Try
<?php
exec(""bash $path_to_script -n 8 -p 1 -t 2 -i 0 -C 0 cnbc.jpg cnbc_1.jpg 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
Do you get any messages?
Try
<?php
exec(""bash $path_to_script -n 8 -p 1 -t 2 -i 0 -C 0 cnbc.jpg cnbc_1.jpg 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
Do you get any messages?
-
- Posts: 13
- Joined: 2015-12-07T07:42:02-07:00
- Authentication code: 1151
Re: Fred's ImageMagick Scripts
Yes, we are getting message given below.
sort: write failed: standard output: Broken pipe
sort: write error
sort: write failed: standard output: Broken pipe
sort: write error
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Fred's ImageMagick Scripts
Does this work?
<?php
exec("convert cnbc.jpg -format '%c' histogram:info:- | sort -k 1 -nr | head -n 8 | sed -n 's/^.*\(#.*\) .*$/\1/p' 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
or
<?php
exec("convert cnbc.jpg -format '%c' histogram:info:- | sort -k 1 | head -n 8 | sed -n 's/^.*\(#.*\) .*$/\1/p' 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
<?php
exec("convert cnbc.jpg -format '%c' histogram:info:- | sort -k 1 -nr | head -n 8 | sed -n 's/^.*\(#.*\) .*$/\1/p' 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
or
<?php
exec("convert cnbc.jpg -format '%c' histogram:info:- | sort -k 1 | head -n 8 | sed -n 's/^.*\(#.*\) .*$/\1/p' 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>