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:
Would this image be good enough for this challenge?