Paint.NET

Welcome to the Paint.NET forum!
It is currently Sun Nov 22, 2009 10:47 am

All times are UTC


Forum rules


Questions or problems with plugin installation? Click here.



Post new topic Reply to topic  [ 41 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Primary Color Difference to Alpha
PostPosted: Sun Aug 19, 2007 12:23 pm 
Offline
User avatar

Joined: Thu Jan 18, 2007 8:37 pm
Posts: 282
Location: where my laptop is
It calculates for every pixel the difference between the pixel and the primary color. The more they are equal, the more alpha will rest. Just duplicate your layer, do my effect with a Primary color selected, maybe some fine tuning with Curves+ alpha channel and there you go affecting only this specially colored part of the image without need of feathering or anything because it's always a smooth gradient from layer to change to the original image layer.

Download here:
Attachment:
File comment: Effect DLL in a ZIP file
EffectDLL.zip [2.45 KiB]
Downloaded 4482 times

Unzip it into your Effects directory in the Paint.NET folder.
It will be listed under Effects -> Color

example:
Image
1 to 2: Here i first chose the sky's color as primary with the Color Picker :ColorPicker: then I ran my effect.
2 to 3: After that I did some alpha fine tuning with Curves+ :Curves: . And the only color effect I added to the sky was increasing saturation and a little hue adjustment :HueSaturation: .
3 to 4: I put the original image as a layer under the modified one.

Link to where you get Curves+

code (Codelab):
Code:
int dr,dg,db;

void Render(Surface dst, Surface src, Rectangle rect)
{
    PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);

    // Delete any of these lines you don't need
    Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();

    ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;

    ColorBgra CurrentPixel;
    for(int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        {
            if (selectionRegion.IsVisible(x, y))
            {
                CurrentPixel = src[x,y];
                dr = CurrentPixel.R - PrimaryColor.R;
                dg = CurrentPixel.G - PrimaryColor.G;
                db = CurrentPixel.B - PrimaryColor.B;
                if (dr < 0)
                 dr=-dr;
                if (dg < 0)
                 dg=-dg;
                if (db < 0)
                 db=-db;
                CurrentPixel.A = (byte)(255-((dr+dg+db)/3));
                dst[x,y] = CurrentPixel;
            }
        }
    }
}


I'm currently searching for a good 16x16 png icon. Please tell me your ideas.

_________________
Image
:Link: website | :Link: imagehost


Last edited by Enormator on Tue Sep 11, 2007 4:45 pm, edited 5 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 19, 2007 12:41 pm 
Offline
User avatar

Joined: Fri Sep 02, 2005 4:44 pm
Posts: 2835
Location: Lyon, France
Hmm...

WOOT! It's Curves+ alpha tweaking made simple, in some sort.

_________________
No. Way. I've just seen Bob. And... *poof!*—just like that—he disappears into the mist again. ~Helio


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 19, 2007 3:37 pm 
Offline
User avatar

Joined: Sat Aug 18, 2007 4:41 pm
Posts: 19
Location: City Of bomd
thanks look nice tuts.....!!!

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 19, 2007 4:38 pm 
Offline
User avatar

Joined: Tue Jan 09, 2007 1:05 pm
Posts: 166
Location: The Netherlands
i have been waiting for this a long time :D

_________________
My Deviant


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 19, 2007 4:55 pm 
Offline
Site Admin, 2008 "Monet" Award Winner, and 2008 King of Paint.NET
User avatar

Joined: Fri Dec 22, 2006 8:29 am
Posts: 5708
Location: http://tinyurl.com/6kqz9v
lestat2000_vamp wrote:
thanks look nice tuts.....!!!


:?: What :?:
You keep saying nice tuts in plugin section?

_________________
Image
All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 19, 2007 11:05 pm 
Offline
User avatar

Joined: Sat Feb 10, 2007 3:09 am
Posts: 2522
Location: Bolivar, MO
I'm a little confused...where would I want to use something like this? Enormator, could you explain the use for your plugin? :)

_________________
Image
"Sadness is easier because it's surrender...I CHOOSE TO FIGHT"
My Gallery


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 8:51 am 
Offline
User avatar

Joined: Thu Jan 18, 2007 8:37 pm
Posts: 282
Location: where my laptop is
You can use it always when you want to edit a picture. Use instead of a selection to get a better gradient without feathering.
You are the artist. I just wrote this plugin to use it for my self and because I'm a nice guy, I posted it here.
For creativity, ask god :P

_________________
Image
:Link: website | :Link: imagehost


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 10:06 am 
Offline

Joined: Wed Jun 28, 2006 3:36 am
Posts: 183
What settings did you use for the plugins?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 8:30 pm 
Offline
User avatar

Joined: Sat Feb 10, 2007 3:09 am
Posts: 2522
Location: Bolivar, MO
Enormator wrote:
You can use it always when you want to edit a picture. Use instead of a selection to get a better gradient without feathering.
You are the artist. I just wrote this plugin to use it for my self and because I'm a nice guy, I posted it here.
For creativity, ask god :P

Thanks for answering Enormator. I'll give it a shot! :D

_________________
Image
"Sadness is easier because it's surrender...I CHOOSE TO FIGHT"
My Gallery


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 10:41 pm 
Offline
User avatar

Joined: Fri Feb 09, 2007 2:47 am
Posts: 138
It looks like it makes the image more vivid to me.
I likey!
[E to the d-it]Whoops, nevermind, I just read right after the pictures. My bad.
Asking god for creativity :oops:

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 10:12 am 
Offline
User avatar

Joined: Wed Aug 01, 2007 5:25 am
Posts: 32
Location: wisconsin
maybe he means toots
like hey toots hows your day ? lol
anyways nice plugin imma go try it out now

_________________
ImageImage


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 22, 2007 1:52 pm 
Offline

Joined: Wed Jun 28, 2006 3:36 am
Posts: 183
Hi Enormator,

I really don't know how you managed to use the curves+ plugin to change your second picture into the third with bleached buildings against a blue sky!

Must be more than just fine adjustments with curves and little fine-tuning with hues!!!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 24, 2007 7:26 pm 
Offline
User avatar

Joined: Thu Jan 18, 2007 8:37 pm
Posts: 282
Location: where my laptop is
Please note, that all the effects were made on top layer. At the end I set the original layer under the changed layer to visible again.

_________________
Image
:Link: website | :Link: imagehost


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 25, 2007 2:28 am 
Offline

Joined: Wed Jun 28, 2006 3:36 am
Posts: 183
Hi Enormator!

I'll take the risk of revealing my ignorance by telling you that I don't know how to change the second picture to the third, nor the third to the fourth in the example that you gave!!

Wonder if you could explain the steps but if it's too bothersome, it's alright.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 25, 2007 10:27 am 
Offline
User avatar

Joined: Thu Jan 18, 2007 8:37 pm
Posts: 282
Location: where my laptop is
No of course it's not to bothersome :)
It's always good, when people ask because I tend to explain in a quite ununderstandable way.

EDIT: I redid the explanation of the example in first post. Is it understandable now? Please ask because I can't see your thoughts. :wink:

_________________
Image
:Link: website | :Link: imagehost


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 41 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 41 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosted by Forumer & phpBB

Get your Forumer™ today!

Adding a forum to your website is a great way to get return visitors.

» Get your own Free Forum!

Terms of Use

Privacy Policy

Report Abuse

Copyright © 2003-2009 Forumer. All Rights Reserved. | Copyright © paint.NET