Coding problem - Solved.
Requirement is explained in detail inside INPUT.
Expected OUTPUT is an image file.
Input and output files are attached.