magickwand tool

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
flash.not
Posts: 5
Joined: 2012-10-05T03:39:18-07:00
Authentication code: 67789

magickwand tool

Post by flash.not »

hello.

I want to implement magic-wand tool like photoshop.

I found required for me functional in this library. F.e. : http://www.fmwconcepts.com/imagemagick/ ... /index.php.
Isolates a contiguous region of an image based upon a color determined from a user specified image coordinate.
This example do what I need. BUT how get boundary coordinate?

Also I read all method from documentation(http://www.magickwand.org/index.html) BUT don't understood HOW get array of region border coordinates.

Thanks for any help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: magickwand tool

Post by fmw42 »

flash.not wrote:hello.

I want to implement magic-wand tool like photoshop.

I found required for me functional in this library. F.e. : http://www.fmwconcepts.com/imagemagick/ ... /index.php.
Isolates a contiguous region of an image based upon a color determined from a user specified image coordinate.
This example do what I need. BUT how get boundary coordinate?

Also I read all method from documentation(http://www.magickwand.org/index.html) BUT don't understood HOW get array of region border coordinates.

Thanks for any help.

Create the binary edge image (assume white lines on black background) from http://www.fmwconcepts.com/imagemagick/ ... /index.php. Then take the output and do

convert edgeimage.gif txt:- | grep -v "black"

That will get all non-black pixels (assuming there has been some antialiasing) if not, then just

convert edgeimage.gif txt:- | grep "white"

to get all white pixels.

see
http://www.imagemagick.org/Usage/files/#txt
flash.not
Posts: 5
Joined: 2012-10-05T03:39:18-07:00
Authentication code: 67789

Re: magickwand tool

Post by flash.not »

thank you for answer!!!

i understand algorithm of my actions.
But, please help me again. On windows i can use your scrips. Please, write options for convert for this variant:

Arguments:
160,200 -t 25 -f mask -r inside -m edge

i try

Code: Select all

D:\>convert.exe D:\123.jpg -fuzz 25% -fill none -draw "matte 300,300 floodfill" -fill black -colorize 100% D:\2.jpg
but not any success result..

i try read and understand your script. i understnad, then transformations occur in 2 stages. i aslo try

Code: Select all

convert $tmp0 -convolve "-1,-1,-1,-1,8,-1,-1,-1,-1" -clamp $tmp0
and
convert $tmp0 $outfile
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: magickwand tool

Post by fmw42 »

My scripts will not work on Windows without Cygwin
convert.exe D:\123.jpg -fuzz 25% -fill none -draw "matte 300,300 floodfill" -fill black -colorize 100% D:\2.jpg
On Windows, you must escape or replace the % with %%

convert.exe D:\123.jpg -fuzz 25%% -fill none -draw "matte 300,300 floodfill" -fill black -colorize 100%% D:\2.jpg

see http://www.imagemagick.org/Usage/windows/
flash.not
Posts: 5
Joined: 2012-10-05T03:39:18-07:00
Authentication code: 67789

Re: magickwand tool

Post by flash.not »

thank you for advice and link.

oh. I was wrong "On windows i can use your scrips". I missed "not". but now that is not important.

if you are not hard, please type the parameters that sets your script for this version (http://d.pr/i/NApx) here. I could not understand this from your script.
flash.not
Posts: 5
Joined: 2012-10-05T03:39:18-07:00
Authentication code: 67789

Re: magickwand tool

Post by flash.not »

ok. i try do this on linux. (but please, not ignore my previous post)
some error...

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: magickwand tool

Post by fmw42 »

flash.not wrote:thank you for advice and link.

oh. I was wrong "On windows i can use your scrips". I missed "not". but now that is not important.

if you are not hard, please type the parameters that sets your script for this version (http://d.pr/i/NApx) here. I could not understand this from your script.

You have already listed the arguments that are used. The syntax is (as explained at the beginning of the example page)

magicwand 160,200 -t 25 -f mask -r inside -m edge logo2.png logo2_t25_mask_in_edge.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: magickwand tool

Post by fmw42 »

flash.not wrote:ok. i try do this on linux. (but please, not ignore my previous post)
some error...

Image

Your unix system (or Windows Cygwin) is missing the unix function bc. You need to install that. I am not a windows user, but I have heard from others that sometimes Cygwin does not have all the unix commands, such as bc, and they need to be installed. Others have found it for Cygwin and have successfully installed bc.

If this is a normal linux system or Mac OSX, then your unix is missing bc and that needs to be installed.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: magickwand tool

Post by fmw42 »

PS

This forum MagickWand for PHP is not the same as Photoshops MagicWand function. The MagickWand for PHP is a PHP API for Imagemagick. They are two totally different things.
flash.not
Posts: 5
Joined: 2012-10-05T03:39:18-07:00
Authentication code: 67789

Re: magickwand tool

Post by flash.not »

thanks for all!

on screenshot normal linux. debian.

bc will install.
The MagickWand for PHP is a PHP API for Imagemagick. They are two totally different things.
i understand. When I created a theme I thought, that someone tell method from MagickWand For PHP, which will help to solve my problem.
But you said me a different way. Yes, we got a little offtopic.

Thanks for all!
Post Reply