For example, if we upscale an image from 100 x 100 to 400 x 300 then we see the pixel stretch in the image which I want to eliminate.
The easiest way I could think is to crop the image to maintain the pixel aspect ratio i.e. upscaling to 300 x 300 or 400 x 400
Edit (Clarification): I want upscale an image without causing pixels to stretch, upsampling algorithms like nearest neighbor, bilinear interpolation, etc cause pixel stretching, especially when there is a change in aspect ratio e.g. from 1:1 to 16:9