Resizing image and lossy compressing