BoltBait

Feather Plugin (Now with Source)

Recommended Posts

Download v3.0 DLL here: BoltBait's Plugin Pack

There have been many requests for a Feather feature (like this one, this one, and this one) so I decided to create it myself.

Thanks goes out to Rick for writing the Gaussian Blur function and to Illnab1024 for sending it to me in Codelab format.

If you don't know what feathering is, take a look at this picture:

edges.jpg

Basically, it softens the edges of objects that you are combining to make composit pictures.

Please see this page for :arrow: instructions on how to use it.

Enjoy. 8)

=============================================

EDIT: I have recompiled this effect with the new CodeLab beta and added an icon to the effect and also added a UI that allows specifying the feather amount (from 1 to 5 with a default of 2).

=============================================

EDIT: Updated again. Changed range from 1-5 to 1-10. Also, added the frequently requested freature of a true feather. The original method is called "grow" as it grows the object slightly. The new method is called "shrink" as it makes the edges of the object slightly transparent--the object shrinks slightly. I also moved the effect to the Blurs submenu. Here is the new UI:

FeatherUI.gif

(4/15/07 update)

=============================================

FIXED: Updated DLL to fix the UI bug where it gets confused if you move the sliders back and forth too much.

(6/11/07 update)

=============================================

FIXED: Fixed a typo. The last time I built this, I accidentally put "feather2" in the menu instead of "Feather".

=============================================

NEW: I have rewritten this effect from scratch. The effect now shows up in the Effects > Object submenu.

It now includes a third slider to control the strength of the effect.

(1/27/2008 update)

=============================================

NEW: I have rewritten this effect's UI from scratch. It now uses the IndirectUI of Paint.NET.

FeatherUI.png

(2/18/2008 Update)

=============================================

FIXED: I have fixed the Paint.NET 3.36 bug.

(8/26/2008 Update)

=============================================

NEW: I have released version 3.0

Download the update here: BoltBait's Plugin Pack

Source code published here:

(4/4/2010 Update)

Share this post


Link to post
Share on other sites

Heh, did you really copy and paste the Gaussian Blur code to do this? That's intense :) I recommend using composition instead ... basically you just instantiate a BlurEffect instance as part of your effect, and act as a proxy to its Render() method. This makes things much more manageable: the Gaussian Blur code is optimized for performance, and its readability and maintainability suffers as a result.

Share this post


Link to post
Share on other sites

Yes, Rick, Illnab1024 sent me the Gaussian Blur code (which he converted for use in Codelab). Then, I tried to understand it (big mistake--it would help if you'd used decent variable names). I figured it out well enough to modify it to my purpose. Then, I compiled the DLL using Codelab and posted it up.

I hope someone finds it useful. I know I will ;)

Share this post


Link to post
Share on other sites

Mmm... this isn't exactly what I'd call a feather. Feathering isn't blurring the edges, it's fading the edges to transparent, which is actually doable with the new gradient tool, to an extent.

Not saying this isn't useful, but calling it a feather isn't very accurate. :/

Share this post


Link to post
Share on other sites
Mmm... this isn't exactly what I'd call a feather. Feathering isn't blurring the edges, it's fading the edges to transparent, which is actually doable with the new gradient tool, to an extent.

Not saying this isn't useful, but calling it a feather isn't very accurate. :/

But, if you think about it, that's EXACTLY what its doing.

If you Gaussian blur a pixel that is sitting next to a totally transparent pixel, it becomes slightly transparent. Then, if you blur that transparent pixel, it takes on some of the color of the previous pixel and becomes slightly less transparent. Isn't that exactly what you describe?

Anyway, I did some experimenting with it and figured out that the blur that I was applying was too small. I had hard set the Gaussian Blur to a radius of 1. I have changed it to 2, recompiled the DLL and re-posted. Except for the smallest of pictures, it is a big improvement.

Share this post


Link to post
Share on other sites
Mmm... this isn't exactly what I'd call a feather. Feathering isn't blurring the edges, it's fading the edges to transparent, which is actually doable with the new gradient tool, to an extent.

Not saying this isn't useful, but calling it a feather isn't very accurate. :/

But, if you think about it, that's EXACTLY what its doing.

If you Gaussian blur a pixel that is sitting next to a totally transparent pixel, it becomes slightly transparent. Then, if you blur that transparent pixel, it takes on some of the color of the previous pixel and becomes slightly less transparent. Isn't that exactly what you describe?

That would be what I'm describing, if the feathered object were a solid color and nothing more.

featherpt9.png

I made this with the gradient tool, rect to polar, and alpha mask. This is a true feather. On the faded edges, not a single pixel has had an RGB value changed, only the alpha transparency. This is what the feather tool in Fireworks does, and I'm pretty sure that applies to other image editing programs.

Share this post


Link to post
Share on other sites

BoltBait, you might be able to do that by doing Gaussian Blur like you are doing, and after that copying all the RGB values (not alpha) from src to dst in the render rectangle. This will effectively do the Gaussian Blur but mask it to just the alpha channel.

Share this post


Link to post
Share on other sites

Rick, the problem with this is that most of the pixels that are being blurred are completely transparent. But, I'll look again at this for the non-transparent pixels.

I'm using the results of the Gaussian blur to slightly expand the size of the new object, not make it smaller.

I played around with making the new object smaller (by only making the edges more transparent) and the results were not looking as good--remember my goal, combining natural objects with a natural background.

Kaiser Yoshi, you are correct. This effect will not work for EVERY image you can come up with. However, for combining natural images, I think you will find it very useful.

EDIT: OK, Rick, I did a test by keeping the RGB values of non-transparent pixels and I couldn't see the difference until I zoomed way in (400%+). And, when I did zoom in and could start to perceive a difference, it didn't look as natural as the regular blur. So, meh. I'm leaving it.

Oh, I'm sure you could come up with a pattern that would show a major difference, but like I said, when used to combine one natural picture with another I think the effect is pretty good.

Share this post


Link to post
Share on other sites

OK, I found a bug in this filter.

It wasn't properly blurring the bottom and right edge pixel of your selection if your selection was not covering the entire layer.

So, if you have not downloaded the DLL since I posted this message, please do so--it has been corrected.

  • Upvote 1

Share this post


Link to post
Share on other sites

Thanks. I don't either.

Oh, and I had already made an icon, but I think I like yours better.

Share this post


Link to post
Share on other sites

Question:

Is it possible to make a similar effect, but instead of "Feathering" it with the transparent pixels, it would work with pixels of the primary color (tolerance changable).

Share this post


Link to post
Share on other sites
Question:

Is it possible to make a similar effect, but instead of "Feathering" it with the transparent pixels, it would work with pixels of the primary color (tolerance changable).

No, because this is based almost completely on the Gaussian Blur code, this would not be possible.*

Sounds like you would want to make helo effects/glow effects. You could put a copy of your object on a new layer, saturate it with the color of your choice, Gaussian Blur that layer, then move that layer below your object.

*Yes, of course it could be possible, I'm just too lazy to make it happen. Not to mention the fact that somehow I misplaced the feather source code file... :(

Share this post


Link to post
Share on other sites

Is it like Shadow X:0 Y:0 Rad:2/5 ?

Yes I so often use shadow effect with x:0 y:0.

It is as usefull as a shortcut. GREAT!!!!

Thanks a lot!

Share this post


Link to post
Share on other sites
Hmm... I don't think that works right? idk. It like, takes the color and puts an outline gradient of that color in transparent areas... or something O.o

HAHA! Yes! I totally misunderstood!

What this does is put a halo around objects by using the primary color for the halo.

I'll see if I can satisfy your request tomorrow when I'm at work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now