* Implementing overwrite instead of saving duplicated images * Using filename instead of hardcoding image type * Refactoring method to accept lambda for default value * Removing extra parenthesis (cherry picked from commit a3afb3553990a6a0faac8999c867b3ddefd5b101)