better support for changing image format