As discussed in your previous question, the graphics portion of your question cannot be implemented in C by itself. The C language does not specify any mechanisms for hardware access.
Also, C is a strongly typed language, so the program cannot be written until you specify the data type that the image reading portion of your program will return.
Your code logic breaks if the image read is not an even length on both sides. C does not have the error() message facilities that MATLAB has, so what should be the proper way to crash the code if the image read in is of odd length on either side?