Changed c_short to c_ushort in write_image as per header file.