Page 1 of 1

Need Help on Feather effect

Posted: 2018-09-18T06:20:37-07:00
by mjamal
Hello Team,

I need to apply feather effect on any of the transparent image which are having different corners and I want to apply the 20px feather for the input image, same as we are applying on photoshop.

Please let me know your valuable inputs which are available in image magick or imagick library.
I have added one below input file for sample which I am using for testing purpose.
5ba0fadb35c3b.png
5ba0fadb35c3b.png (68.48 KiB) Viewed 92128 times

Re: Need Help on Feather effect

Posted: 2018-09-18T08:23:57-07:00
by fmw42
Try this Imagemagick command line. Adjust the blur level as desired. Sorry I do not know Imagick equivalents.

Code: Select all

convert 5ba0fadb35c3b.png -channel a -blur 0x7 -level 50x100% +channel result.png

______________________

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown

Re: Need Help on Feather effect

Posted: 2018-09-19T06:02:56-07:00
by mjamal
Thank you Fred, your provided code is working as expected, only I need to know where exactly I need to put the value 25 for the 25px feather radius in your below provided script, It is at "-level 25x100%" or "-blur 0x25" for setting the 25px feather effect same as in photoshop?

convert 5ba0fadb35c3b.png -channel a -blur 0x7 -level 50x100% +channel result.png

Re: Need Help on Feather effect

Posted: 2018-09-19T20:01:48-07:00
by fmw42
It would be in the blur. But Imagemagick does not use the same blur arguments as photoshop. So you will need adjustment the blur value where I have 7 to something that matches what you get from photoshop. My guess was 7 but 8 might be better. Since 8x3=24 is close to 25.

Alternately, try this variation.

Code: Select all

convert 5ba0fadb35c3b.png -channel a -blur 25x65000 -level 50x100% +channel result.png
Here I specified a 25 pixel linear blur rather than the 7 or 8 pixel gaussian blur sigma. So if 25 does not work adjust the 25 value from 25x65000 argument. Do not change 65000.

Re: Need Help on Feather effect

Posted: 2019-01-09T02:28:02-07:00
by mjamal
Hello Team,

Can anyone please help me for applying the feathering differently from the horizontal and vertically for an image.
I am using below command but unfortunately it is taking long time to apply the feathering on result image.

Code: Select all

exec("convert checkFeather-TRIM.png \( +clone -alpha extract -threshold 0% +duplicate -compose blur -define compose:args='11x21' -composite -level 50x100% \) -alpha off -compose CopyOpacity -composite result112.png");
Below is the input image URL.
https://www.dropbox.com/s/pldzxwx1ss37o ... M.png?dl=0

Please provide any solution so that I can apply feathering as quick as possible, right now for this mentioned image the script taking around 40 seconds.

Thanks in advanced.

Re: Need Help on Feather effect

Posted: 2019-01-09T03:23:36-07:00
by snibgo
You are using "-compose blur", which gives a variable size blur, where the size is according to the mask (which in your case is a duplicate of the extracted alpha). As almost all pixels have alpha either 0 or 100%, the variable effect is wasted. Do you really want a variable blur? If not, a simple "-blur 0x10" or whatever is far quicker.

Even quicker, you don't need to extract alpha and finally copy-opacity. Simply apply the blur to just the alpha channel:

Code: Select all

convert checkFeather-TRIM.png -channel A -blur 0x10 +channel out.png