you need to use a library for this purpose if don't want to implement everything from scratch. Sree's answer looks to be from ancient ms-dos and turbo c time.
one is ImageMagick:
another is openCV, SDL... try a google search will reveal more...
keep in mind that GUIs and using graphics are extremely OS dependent and they have to use the host OS APIs. This will add another layer of complexity on top of image manipulation.