Check available image formats when saving

Fixes issue #59