Resize using an appropriate algorithm depending on upscaling or downscaling