fix a bug in making an image from one of a different dtype