I am uploading a pic of document taken with my smart phone to my linux server. On my linux server i am using image magic to cut the edges and do some processing(like gray color coding) to make it look like a scanned document. Below is one sample image
I want to trim the image so that only the paper is selected and do further processing to make it look like a scanned image, similar to what cam scanner does. Can you please help me in achieving this.
Note: I want the parameters for image magic tool to be generic so that i can use the same command line options to process images taken under different conditions of light.