wbobeirne Posted December 12, 2011 Share Posted December 12, 2011 Hey Paint.net forums, I've been having a hard time googling this question as it's hard to put in bite-size words. I'm looking for an easy way to take the alpha levels of each pixel on one layer, and then combine that with the color levels of each pixel on another layer. Let me give you an example. I want to take the alpha levels of image 1, replace the colors with the colors of image 2, and be left with image 3 (Only no background, because the alpha level should be zero!) http://i.imgur.com/gWA5K.png I achieved the effect you see in image 3 by using the "difference" blending, and then inverting the image. Problem is, I've still got the gradient as a background which doesn't really work because that icon needs to sit on anything. If anyone can help me out, I'd be eternally grateful! Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted December 12, 2011 Share Posted December 12, 2011 You'll need to download & install the alpha mask plugin: Alpha Mask Import (1.2) 1. Open the first image and add a white background to a new layer underneath the initial layer. Flatten. 2. Invert the colors (CTRL+Shift+I). This should give you a white magnifying glass on a black background. 3. Save file as a PNG - to use as your alpha mask. 4. Open second image. 5. Go to Effects > Object and select Alpha Mask. 6. Browse to your saved mask file. 7. Click OK. Howzat? Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
wbobeirne Posted December 12, 2011 Author Share Posted December 12, 2011 (edited) Ah, you're a wizard! Unfortunately, because I got impatient and I was looking for a challenge, I wrote my own C# program to do this by taking the alpha values of one image, and the color values of another. Still, I hope this helps someone else who was looking for this answer! Edited December 12, 2011 by wbobeirne Quote Link to comment Share on other sites More sharing options...
david.atwell Posted December 12, 2011 Share Posted December 12, 2011 You got impatient and wrote that in a half hour?!? Wow, you have some SERIOUS skills. Quote The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.Amy: But how did it end up in there?The Doctor: You know fairy tales. A good wizard tricked it.River Song: I hate good wizards in fairy tales; they always turn out to be him. Link to comment Share on other sites More sharing options...
wbobeirne Posted December 13, 2011 Author Share Posted December 13, 2011 You got impatient and wrote that in a half hour?!? Wow, you have some SERIOUS skills. While I'd love to indulge myself in that compliment, it's actually much simpler than I'd expected. You just run through each pixel of 2 images, mash up the ARGB values, and spit out a new image. If anyone's curious, here's the code: Bitmap newBmp = new Bitmap(bmpAlpha.Width, bmpAlpha.Height); for (int x = 0; x < bmpAlpha.Width; x++) { for (int y = 0; y < bmpAlpha.Height; y++) { Color alphaColor = bmpAlpha.GetPixel(x, y); Color colorColor = bmpColor.GetPixel(x, y); Color newColor = Color.FromArgb(alphaColor.A, colorColor.R, colorColor.G, colorColor.; newBmp.SetPixel(x, y, newColor); } } The .Net framework makes this problem super easy. The only downside is it only works with images of the same dimension, but that wouldn't be too hard to fix. However, doing this in Paint.Net is way more versatile, quick, and easy. Quote Link to comment Share on other sites More sharing options...
david.atwell Posted December 13, 2011 Share Posted December 13, 2011 Still more than we've come to expect from newbies to the forum, that's for sure. Quote The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.Amy: But how did it end up in there?The Doctor: You know fairy tales. A good wizard tricked it.River Song: I hate good wizards in fairy tales; they always turn out to be him. 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.