private static int detectEndFirtRedLine(Bitmap bmp, int initRedY)
{
int redY = -1;
try {
for (int h = initRedY; h < bmp.Height; h++){
Color c = bmp.GetPixel(0, h);
if (c.R != 255){
bool isRedLine = true;
for (int w = 0; w < bmp.Width; w++) {
c = bmp.GetPixel(w, h-1);
if (c.R != 255) {
isRedLine = false;
break;
}
}
if (isRedLine){
redY = h - 1;
break;
}
}
}
}catch(Exception e){}
return redY;
}