adding save image functionality