[Resolved] Anti-alias image help.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Cmars
Posts: 8
Joined: 2010-10-29T12:03:56-07:00
Authentication code: 8675308

[Resolved] Anti-alias image help.

Post by Cmars »

Well I'm trying to make the image's edges soften so they don't look sharp (transparent background), and I can't seem to get it to work:

Code: Select all

convert "C:\imgs\a.png" -antialias "C:\imgs\a.png"
So yea, I need some help here :/
And yes, I've been searching/tried things for 7 days, but nothing works :/ <.<
Last edited by Cmars on 2010-10-30T04:47:30-07:00, edited 3 times in total.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Anti-alias image help.

Post by Bonzo »

Check this link ( will need to scroll down the page a bit ): http://www.imagemagick.org/Usage/thumbnails/#fluff
Cmars
Posts: 8
Joined: 2010-10-29T12:03:56-07:00
Authentication code: 8675308

Re: Anti-alias image help.

Post by Cmars »

Ok, I can't find anything <.<
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Anti-alias image help.

Post by Bonzo »

http://www.imagemagick.org/Usage/thumbnails/#soft_edges

I thought you were trying to do something like:
Image or Image

If not post an example of what you want.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Anti-alias image help.

Post by fmw42 »

Cmars wrote:Well I'm trying to make the image's edges soften so they don't look sharp (transparent background), and I can't seem to get it to work:

Code: Select all

convert "C:\imgs\a.png" -antialias "C:\imgs\a.png"
So yea, I need some help here :/
And yes, I've been searching/tried things for 7 days, but nothing works :/ <.<

-antialias is a setting used with some operator such as -draw. by itself it does nothing.

I think you need to post a link to your example(s) and explain in more detail what is the issue or what you desire for the result.
Cmars
Posts: 8
Joined: 2010-10-29T12:03:56-07:00
Authentication code: 8675308

Re: Anti-alias image help.

Post by Cmars »

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

Re: Anti-alias image help.

Post by fmw42 »

you need to take the mask and make it binary. then blur the mask a little with a linear ramp blur, then make the ramp taper to cut out the outside part of the blur.


Here are two ways to do that. You can adjust the -blur 1x65000 (change the 1 to 0.5 or 2 or whatever) as desired.

convert Sir_amik_varze_detail.PNG \
\( -clone 0 -alpha off \) \
\( -clone 0 -alpha extract -blur 1x65000 -level 50x100% \) \
-delete 0 -compose copy_opacity -composite Sir_amik_varze_detail1.png

convert Sir_amik_varze_detail.PNG -channel A -blur 1x65000 -level 50x100% \
-channel rgba Sir_amik_varze_detail1b.png
Cmars
Posts: 8
Joined: 2010-10-29T12:03:56-07:00
Authentication code: 8675308

Re: Anti-alias image help.

Post by Cmars »

fmw42 wrote:you need to take the mask and make it binary. then blur the mask a little with a linear ramp blur, then make the ramp taper to cut out the outside part of the blur.


Here are two ways to do that. You can adjust the -blur 1x65000 (change the 1 to 0.5 or 2 or whatever) as desired.

convert Sir_amik_varze_detail.PNG \
\( -clone 0 -alpha off \) \
\( -clone 0 -alpha extract -blur 1x65000 -level 50x100% \) \
-delete 0 -compose copy_opacity -composite Sir_amik_varze_detail1.png

convert Sir_amik_varze_detail.PNG -channel A -blur 1x65000 -level 50x100% \
-channel rgba Sir_amik_varze_detail1b.png
Thank you.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Anti-alias image help.

Post by fmw42 »

if the edges pull in too much, beside making the 1 smaller, you can instead try to adjust the 50x100% (say make the 50 to 45 or 40).

Also see http://www.imagemagick.org/Usage/channels/#mask_diff
Cmars
Posts: 8
Joined: 2010-10-29T12:03:56-07:00
Authentication code: 8675308

Re: Anti-alias image help.

Post by Cmars »

Thanks for all help
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [Resolved] Anti-alias image help.

Post by anthony »

You could try using a feathering blur, of the alpha channel combined with the original channel to ensure fully-transparent pixels don't become partially transparent
http://www.imagemagick.org/Usage/blur/#feathering
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply