Updated image type conversion and added test.