BoltBait Posted April 4, 2007 Share Posted April 4, 2007 Soften Portrait Effect I'm still learning how to create complex effect filters for Paint.NET. This is the first one that I wrote that combines preexisting effects. After I wrote this one, I did the Ink Sketch effect. The Idea The idea for this plugin came from belman92's post here. I thought that it would be easy to automate the steps that are sometimes used to make portraits look softer and more professional. You can use this on other pictures, but it really is meant for portraits. It adds a little brown to smooth out skin but not too much detail is lost. Here is an example pic of my lovely wife: <snip demonstration photo> The Effect DLL NOTE: This effect is now included in Paint.NET. If you have upgraded to Paint.NET 3.10 or greater, you do not need to download this effect... you already have it! Instructions for Use The best way to use this is to follow these steps: 1. Open your graphic. 2. Click the Effects > Portrait menu. 3. Adjust the sliders for the desired effect. More Info As always, more information can be found here: http://boltbait.googlepages.com/portrait Source Code To understand this code, first read the Ink Sketch thread. Go ahead, I'll wait. Back? OK, here ya go: /* PortraitEffect.cs Copyright (c) 2007 David Issel Contact Info: BoltBait@hotmail.com http://www.BoltBait.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Collections; using System.Drawing; using PaintDotNet; using PaintDotNet.Effects; namespace PortraitEffect { public class EffectPlugin : PaintDotNet.Effects.Effect { public static string StaticName { get { return "Soften Portrait"; } } public static Bitmap StaticIcon { get { return new Bitmap(typeof(EffectPlugin), "EffectPluginIcon.png"); } } private BlurEffect blurEffect = new BlurEffect(); private UnaryPixelOps.Desaturate desaturateOp = new UnaryPixelOps.Desaturate(); private SepiaEffect sepiaEffect = new SepiaEffect(); private BrightnessAndContrastAdjustment bacAdjustment = new BrightnessAndContrastAdjustment(); private UserBlendOps.OverlayBlendOp OverlayOp = new UserBlendOps.OverlayBlendOp(); private UnaryPixelOp levels; public override unsafe void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length) { ThreeAmountsConfigToken tacd = (ThreeAmountsConfigToken)parameters; float RedAdjust = 1.0f + ((float)tacd.Amount3 / 100.0f); float BlueAdjust = 1.0f - ((float)tacd.Amount3 / 100.0f); AmountEffectConfigToken blurToken = new AmountEffectConfigToken(tacd.Amount1 * 3); BrightnessAndContrastAdjustmentConfigToken bacToken = new BrightnessAndContrastAdjustmentConfigToken(tacd.Amount2, -tacd.Amount2/2); this.blurEffect.Render(blurToken, dstArgs, srcArgs, rois, startIndex, length); this.bacAdjustment.Render(bacToken, dstArgs, dstArgs, rois, startIndex, length); for (int i = startIndex; i < startIndex + length; ++i) { Rectangle roi = rois[i]; for (int y = roi.Top; y < roi.Bottom; ++y) { ColorBgra* srcPtr = srcArgs.Surface.GetPointAddress(roi.Left, y); ColorBgra* dstPtr = dstArgs.Surface.GetPointAddress(roi.Left, y); for (int x = roi.Left; x < roi.Right; ++x) { ColorBgra srcGrey = this.desaturateOp.Apply(*srcPtr); srcGrey.R = Utility.ClampToByte((int)((float)srcGrey.R * RedAdjust)); srcGrey.B = Utility.ClampToByte((int)((float)srcGrey.B * BlueAdjust)); ColorBgra mypixel = this.OverlayOp.Apply(srcGrey, *dstPtr); *dstPtr = mypixel; ++srcPtr; ++dstPtr; } } } } public override EffectConfigDialog CreateConfigDialog() { ThreeAmountsConfigDialog tacd = new ThreeAmountsConfigDialog(); tacd.Text = StaticName; tacd.Amount1Label = "Soften"; tacd.Amount1Minimum = 0; tacd.Amount1Maximum = 10; tacd.Amount1Default = 5; tacd.Amount2Label = "Lighting"; tacd.Amount2Minimum = -20; tacd.Amount2Maximum = 20; tacd.Amount2Default = 0; tacd.Amount3Label = "Warmth"; tacd.Amount3Minimum = 0; tacd.Amount3Maximum = 20; tacd.Amount3Default = 10; return tacd; } public EffectPlugin() : base(StaticName, StaticIcon, true) { } } } Note: This is NOT a codelab script! Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
BuzzKill Posted April 4, 2007 Share Posted April 4, 2007 I really love this plugin. It has a dimming and glowing effect all at the same time: an example Ah! I got BoltBaits in my history window! Quote - DO NOT contact me asking for the .pdn of my avatar or the PDN logo. Thank you. Have a nice day. Link to comment Share on other sites More sharing options...
Riot Posted April 4, 2007 Share Posted April 4, 2007 I like it. Good job. Quote ^^ First Creation with Paint.NET Link to comment Share on other sites More sharing options...
BoltBait Posted April 4, 2007 Author Share Posted April 4, 2007 BuzzKill!!!! I'm in ur Paint Dot Net... eatin' ur cookie. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Leif Posted April 4, 2007 Share Posted April 4, 2007 Thanks. Those two plugin looks really interesting. I just bought a scanner, so they might come in very handy. Quote My DA: http://leif-j.deviantart.com/ -------------- Some people seek justice so persistent, that they will do great injustice themselves. Link to comment Share on other sites More sharing options...
Helio Posted April 4, 2007 Share Posted April 4, 2007 When BoltBait jumped in my effects menu, he fixed it! Now I have arrows! BoltBait to the rescue. NO, I don't have a cat. Quote v An excellent open–source strategy game—highly recommended. "I wish I had never been born," she said. "What are we born for?" "For infinite happiness," said the Spirit. "You can step out into it at any moment..." Link to comment Share on other sites More sharing options...
davidtayhs Posted April 4, 2007 Share Posted April 4, 2007 Thanks for a wonderful portrait plugin! Simplifies process of making older men and women look better!! Quote Link to comment Share on other sites More sharing options...
MadJik Posted April 4, 2007 Share Posted April 4, 2007 Another good plugin :plugin: ! I like it ! Thanks... =>joke : ETA for Landscape plugin ? I'm still learning how to create complex effect... I'm learning too, so I would much appreciate to see the source, for my self learning! Quote My DeviantArt | My Pictorium | My Plugins | Donate via Paypal Link to comment Share on other sites More sharing options...
BoltBait Posted April 5, 2007 Author Share Posted April 5, 2007 As you can see from Helio's example, not every picture is a good candidate for this plugin. I'm still learning how to create complex effect... I'm learning too, so I would much appreciate to see the source, for my self learning! I don't know... every time I post my souce code, you take it, learn from it, and totally show me up by writing a better plugin than me!!! Maybe I'll post the source after I write that Landscape plugin. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Mr Frojo Posted April 5, 2007 Share Posted April 5, 2007 Looks pretty nice. I have a picture that this can be done to, but its on my crashed hard drive. Quote I'm still alive! Link to comment Share on other sites More sharing options...
jpope Posted April 6, 2007 Share Posted April 6, 2007 Great plugin. Works great for other stuff too. Before: After: Thanks BoltBait. Quote Link to comment Share on other sites More sharing options...
Picc84 Posted April 6, 2007 Share Posted April 6, 2007 Cool pluginn! and i'm waiting for Madjik's versian Quote Link to comment Share on other sites More sharing options...
belman92 Posted April 8, 2007 Share Posted April 8, 2007 wow i'm glad my idea based on hpebley3's orton effect was made into a plugin! great job BoltBait! Quote Link to comment Share on other sites More sharing options...
zisworg Posted April 14, 2007 Share Posted April 14, 2007 Awesome !! Another BIG (*very good*) BoltBait's plugin ! Thanks so much. Quote Link to comment Share on other sites More sharing options...
olav.k.m Posted April 20, 2007 Share Posted April 20, 2007 wow. I love this plugin! Quote Link to comment Share on other sites More sharing options...
Nesk Posted April 28, 2007 Share Posted April 28, 2007 Wow, thats a great plugin! Thanks for sharing it. Quote Link to comment Share on other sites More sharing options...
Zeras737 Posted May 3, 2007 Share Posted May 3, 2007 Once again Bolt you've done it again! Mkaing me and my PC art powers happy :-) Quote Link to comment Share on other sites More sharing options...
BoltBait Posted May 28, 2007 Author Share Posted May 28, 2007 Updated the DLL. I added a third slider. I also adjusted what the sliders do. I was never happy with the "feel" of control you had over the results with the old version. Hopefully, you will feel more in control of the effect with this version. See the links in the first post for the download. Enjoy. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Ash Posted May 28, 2007 Share Posted May 28, 2007 Very nice! Thank you Quote All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ] Link to comment Share on other sites More sharing options...
jpope Posted May 28, 2007 Share Posted May 28, 2007 Rock on BoltBait. You've made one of my favorite plugins even better. Thanks. Quote Link to comment Share on other sites More sharing options...
Hope Posted July 2, 2007 Share Posted July 2, 2007 i like this effect! its really cool it makes a picture cherubic in a way! Quote Link to comment Share on other sites More sharing options...
Undaunted Posted September 14, 2007 Share Posted September 14, 2007 Hey just wanted to say how much I love this plugin and it's integration into the core program. Two of my favorite pictures as examples: http://flickr.com/photos/undaunted/1364872177/ http://flickr.com/photos/undaunted/1265285401/ I actually like the effect more on non-portrait things like skyscrapers and shadowy areas, although it does do good work on portraits too as you can see in the first example. I love Paint.net but I was curious how to make a similar effect in other programs (moving to Mac soon), I see the blur but where does the glow come from? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.