Refactored image export to support multiple file types.