Jump to content
How to Install Plugins ×

Toon Filter


ownage

Recommended Posts

afterwf0.jpgafterwm6.jpg

 

Download

 

Just unzip this file and save the dll file in your /Program Files/Paint.NET/Effects folder.

 

 

Code Lab Code

Spoiler

// filter kernel

const int size = 5; // odd number


//play around with the matrix for interesting effects.

int[,] conv = new int[size, size]
{
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  30,  -1, -1},
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  -5,  -1, -1},
};

unsafe void Render(Surface dst, Surface src, Rectangle rect)
{
    int radius = (size-1)/2;
    for(int y = rect.Top; y < rect.Bottom; y++)
    {
        int top = y - radius, bottom = y + radius;
        if (top < 0) top = 0;
        if (bottom >= dst.Height) bottom = dst.Height - 1;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            int left = x - radius, right = x + radius;
            int c = 0, s = 0, r = 0, g = 0, b = 0;
            if (left < 0) left = 0;
            if (right >= dst.Width) right = dst.Width - 1;
            for (int v = top; v <= bottom; v++)
            {
                ColorBgra *pRow = src.GetRowAddressUnchecked(v);
                int j = v - y + radius;

                for (int u = left; u <= right; u++)
                {
                    int i = u - x + radius;
                    int w = conv[i, j];
                    ColorBgra *pRef = pRow + u;
                    r += pRef->R * w;
                    g += pRef->G * w;
                    b += pRef->B * w;
                    s += w;
                    c++;
                }
            }
            dst[x, y] = ColorBgra.FromBgr(
                Int32Util.ClampToByte(b),
                Int32Util.ClampToByte(g),
                Int32Util.ClampToByte(r));
        }
    }
}

 

 
 
Edited by Ego Eram Reputo
Updated toon filter to Null54's version
Link to comment
Share on other sites

I seem to get a different effect when I apply the filter to the picture at the top, are you going to add a way to adjust the level of the filter?

You can get a good effect if you take a picture, duplicate the layer, apply the filter to the top level and play with the opacity.

b1lancersig4hj.jpg
Link to comment
Share on other sites

you can get a pencil sketch kind of effect.

alita02fi3.jpgalita02toonvm4.jpg

intensity of the filter is controlled by the size of the filter kernel matrix, bigger matrix = higher intensity.

Link to comment
Share on other sites

Cool plugin, might have to look at adding something like this for a 2.7x update ;)

Is that Rachel Bielson? I can think of only positive things to say about her ... ha!

  • Upvote 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

I love your Toon filter, but it needs an icon in the effects menu.

Oh, and I've noticed that the TOON filter interacts nicely with other filters. For example, taking your original image I did a Frosted Glass (1), TOON, Blur (1):

afterwf0.jpgFG1_TOON_GB1.jpg

This gives is a very rough look (crayons?) that I really like.

I think a lot can be learned by looking at the source code to this effect.

Link to comment
Share on other sites

I go for more of a ditigalized look I guess if you can call it that.

I gotta get on my fast comp to do this though.

Take a pic, TOON it, then blur it 1-2 px

ravennm3.png
Link to comment
Share on other sites

Is there any way to actually adjust anything in this plugin?

All i can do is "Tool", and then my img gets changed, but after two times "Tool" there is nothing new anymore...

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...

Discovered one way to improve the results for some pictures:

1. Apply the toon effect to the background pic

2. Copy the toon effect to the clipboard

3. Undo the toon effect on the background to get its original state

4. Create a new layer, paste the clipboard contents, and then going to the Layer --> Layers Property, adjust the opacity to about 139 or whatever setting suits your eye.

5. Flatten the immage.

I think these steps create quite lovely pictures.

Link to comment
Share on other sites

davidtayhs, that sounds similar to what I described in this post:

http://paintdotnet.12.forumer.com/viewtopic.php?t=2785

(scroll down about half way and you'll see this picture...)

2kids.jpg

Here is how to make this picture:

Before you begin, you'll need the Toon effect plugin and optionally the Pastel effect plugin.

Open an image. It opens on the background layer.

Duplicate the background layer. Call this layer "outline". Make it invisible for now.

Select the backgound layer and run the Oil Paint effect (defaults).

Now Gaussian Blur the background layer with Radius 1.

Select the background layer and run the Glow effect. Radius 6, lower the contrast, adjust the brightness as desired. I used -78 on both for this picture.

(Or, you could just run the crappy Pastel effect I wrote.)

Select the "outline" layer and make it visible.

Run the Toon effect on the outline layer.

Now select Adjustments > Black and White.

Create a new layer called "Eyes".

Select the "outline" layer and lasso the whites of the eyes. You'll have to do these one at a time. Copy the white area of the eyes and paste it into the new "Eyes" layer.

When done with that, select the "Eyes" layer and Gaussian Blur it with a Radius 1.

Select the "Outline" layer and change the properties to Blending Mode: Darken.

That's it. ;)

NOTE: You don't have to do all of these steps anymore. I have created an effect that will do them all for you! Download it here:

https://forums.getpaint.net/topic/3474-ink-sketch-effect-plugin-now-with-source-code/

Enjoy. 😎

  • Upvote 1
Link to comment
Share on other sites

Nope, your technique definitely gives superior results.

Didn't think of combining so many effects together - Oil Paint, Gaussian Blur, Glow, Toon effect etc!

Was experimenting to get a better result from the Toon effect. Liked your result so much I printed out the steps and the photo for reference. Thanks.

Link to comment
Share on other sites

Nope, your technique definitely gives superior results.

Thanks!

I'm always on the lookout for techniques that would take a normal photograph and turn it into something "drawn". To me, this makes it look as if the picture was drawn in pen and painted with water colors.

This technique is the closest I've come using Paint.NET.

BTW, sometimes it looks better to use "Screen" instead of "Darken" in the last step.

Link to comment
Share on other sites

  • 3 weeks later...

didn't work that well with the pic i used, you need one with lots of potential lines. Actually, i did it without the oil paint and pastel effect 9the pastel effect sorta sucks, sorry) but lots of glow and it looked good.

Link to comment
Share on other sites

  • 1 month later...
  • 7 months later...

Found a simple way to use the Toon effect to make beautiful pictures by combining it with the Ed Harvey Surface Blur effect:

1. Open the picture that you want to apply the Toon effect on.

2. Duplicate this layer so that you have two layers with the same picture.

3. Apply the Toon effect onto the new layer (the top layer on the Layers' window).

4. Apply the Ed Harvey Surface Blur effect onto the 'tooned' layer.

5. Going to the Layers' menu --> Layer's Properties --> Keep the mode 'Normal' but reduce opacity to about 140.

6. Flatten the layers.

7. Admire your finished product - lol!

Link to comment
Share on other sites

  • 3 months later...

it could use a bit of work... i think this one will be great once you make all the necessary tweaks to it

Sk8rboy1091Sig4.jpg

if you have any better suggestions for my sig, pm me...

Link to comment
Share on other sites

  • 2 months later...
Is that Rachel Bielson? I can think of only positive things to say about her ... ha!

LOL!

That is Gally, Rick Brewster.

"Puyo~! I'm Wapiku~chan!"-Wapiku, from Goldfish Waring!

Link to comment
Share on other sites

  • 1 year later...
  • 8 months later...
On 10/11/2007 at 6:46 PM, davidtayhs said:

Found a simple way to use the Toon effect to make beautiful pictures by combining it with the Ed Harvey Surface Blur effect:

1. Open the picture that you want to apply the Toon effect on.

2. Duplicate this layer so that you have two layers with the same picture.

3. Apply the Toon effect onto the new layer (the top layer on the Layers' window).

4. Apply the Ed Harvey Surface Blur effect onto the 'tooned' layer.

5. Going to the Layers' menu --> Layer's Properties --> Keep the mode 'Normal' but reduce opacity to about 140.

6. Flatten the layers.

7. Admire your finished product - lol!

@davidtayhs Thanks for the mini tutorial. It works very well - at least to my liking. B)

 

Toon-Plugin.png

Edited by AndrewDavid
Refreshed Link

PaintNetSignature.png.6bca4e07f5d738b2436f83d0ce1b876f.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...