freeimage: Correctly handle saving uint16 images (closes gh-1101)