0

Based on this : http://www.rapidtables.com/web/color/gray-color.htm to scale it in its proper shade of grey. Here's the code that I put in between the fread() and frwrite() functions.

            int red = triple.rgbtRed;    


            if(red > 235 && red <= 255)
            {
                triple = (RGBTRIPLE) {255,255,255};
            }
            else if(red > 220 && red <= 235)
            {
                triple = (RGBTRIPLE) {211,211,211};
            }
            else if(red > 210 && red <= 220)
            {
                triple = (RGBTRIPLE) {192,192,192};
            }
            else if(red > 175 && red < 200)
            {
                triple = (RGBTRIPLE) {169,169,169};
            }
            else if(red > 150 && red <= 175)
            {
                triple = (RGBTRIPLE) {128,128,128};
            }
            else if(red > 125 && red <= 150)
            {
                triple = (RGBTRIPLE) {105,105,105};
            }
            else if(red > 75 && red <= 100)
            {
                triple = (RGBTRIPLE) {119,136,153};
            }
            else if(red > 50 && red <= 75)
            {
                triple = (RGBTRIPLE) {112,128,144};
            }
            else if(red > 25 && red <= 50)
            {
                triple = (RGBTRIPLE) {47,79,79};
            }
            else if(red >= 0 && red <= 25)
            {
                triple = (RGBTRIPLE) {0,0,0};
            }

Output:

enter image description here

Would this image be good enough for this challenge?

0

You just have to convert all only_red(ff0000) pixels to white(ffffff) and nothing to do with other pixels.And make sure to skip over padding and write back to output file.No need to change pixel color over ranges of red in it.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .