Refactor Image format management
(Saving images still have some issues)