Implemented background replacement for different image sizes