Matto555 Posted May 3, 2018 Share Posted May 3, 2018 So, I'm trying to create a greyscale heightmap, and basically for whatever reason I have a heightmap that is tainted blue. Basically what I want to change is make it so that where it's rgb (0, 0, 98) I want it to be rgb (98, 98, 98) and where it's rgb (0, 0, 65) I want it to be rgb (65, 65, 65) and so on. I tried using the simple black & white tool but that doesn't give the result I'm trying to get, as I need to keep the base rgb value of blue the same and basically make the red and green values equal to the blue values throughout the entire image as the red and green values are all 0 currently. Hopefully that makes sense and there's a solution to this. Thanks! Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted May 3, 2018 Share Posted May 3, 2018 This will copy the value of the Blue channel to the Red and Green channels. void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; CurrentPixel.R = CurrentPixel.G = CurrentPixel.B; dst[x,y] = CurrentPixel; } } } https://forums.getpaint.net/topic/111233-codelab-for-average-users-a-laymans-guide/ Is this what you're looking for? 1 1 Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
MJW Posted May 3, 2018 Share Posted May 3, 2018 If you want a pre-built plugin, Black and White+ will work if you set the Blue and Green weights to 0. (Setting the Red weight to 1 isn't necessary, since the weights are normalized by default.) Quote Link to comment Share on other sites More sharing options...
Matto555 Posted May 3, 2018 Author Share Posted May 3, 2018 (edited) 47 minutes ago, toe_head2001 said: This will copy the value of the Blue channel to the Red and Green channels. void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; CurrentPixel.R = CurrentPixel.G = CurrentPixel.B; dst[x,y] = CurrentPixel; } } } https://forums.getpaint.net/topic/111233-codelab-for-average-users-a-laymans-guide/ Is this what you're looking for? Yep! That's exactly what I wanted! Thanks! Edited May 3, 2018 by Matto555 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.