def gray_pattern_borders(image):
width, height = image.size;<EOL>width_start = width;<EOL>width_end = <NUM_LIT:0>;<EOL>height_start = height;<EOL>height_end = <NUM_LIT:0>;<EOL>row, col = <NUM_LIT:0>, <NUM_LIT:0>;<EOL>for pixel in image.getdata():<EOL><INDENT>value = float(pixel[<NUM_LIT:0>]) * <NUM_LIT> + float(pixel[<NUM_LIT:1>]) * <NUM_LIT> + float(pixel[<NUM_LIT:2>]) * <NUM_LIT>;<EOL>if (value < <NUM_LIT>):<EOL><INDENT>if (width_end < col): <EOL><INDENT>width_end = col;<EOL><DEDENT>if (height_end < row):<EOL><INDENT>height_end = row;<EOL><DEDENT>if (width_start > col):<EOL><INDENT>width_start = col;<EOL><DEDENT>if (height_start > row):<EOL><INDENT>height_start = row;<EOL><DEDENT><DEDENT>col += <NUM_LIT:1>;<EOL>if (col >= width):<EOL><INDENT>col = <NUM_LIT:0>;<EOL>row += <NUM_LIT:1>;<EOL><DEDENT><DEDENT>return (width_start, height_start, width_end + <NUM_LIT:1>, height_end + <NUM_LIT:1>)<EOL>
!
    @brief Returns coordinates of gray image content on the input image.

    @param[in] image (Image): PIL Image instance that is processed.

    @return (tuple) Returns coordinates of gray image content as (width_start, height_start, width_end, height_end).