determine image format