made changes to prefer freeimage over pil for imread