I hope you like Java.Get the image. (Also download the image and the HTML source code)Get max Horizontal and Vertical values.Read pixel 0,0 -> MaxHor,MaxVer    - If the pixel is white, ignore it.    - If the pixel is the first encountered non-white pixel, record the RGB values as BASEred, BASEgreen, BASEblue.    - If pixel is non-white and post first-encounter, check if RGB equals BASE values. If yes, write it's X and Y value to list "1" otherwise add to list "2"Check which list is smaller.Get the first X and Y value from the smaller listGet the new image using the X and Y value.Repeat.