Image scaling is the resizing of a digital image in computer graphics and digital imaging. In video technology, the amplification of digital content is referred to as upscaling or resolution improvement.
When scaling a vector graphic image, the graphic primitives that comprise the image can be scaled with no loss of image quality utilizing geometric transformations. When scaling a raster graphics image, a new image with more or fewer pixels must be created. When the pixel number is reduced (scaling down), there is usually an apparent quality reduction. Scaling raster graphics is a two-dimensional example of sample-rate conversion, which is the conversion of a discrete signal from one sampling rate (in this case, the local sampling rate) to another.
According to the Nyquist sampling theorem, picture scaling is a type of image resampling or image reconstruction. According to the theorem, downsampling from a higher-resolution original to a smaller image can only be done after applying an appropriate 2D anti-aliasing filter to avoid aliasing artifacts. The image is reduced to the information that the smaller image can carry.
The image size can be changed in several ways.
One of the simplest methods of expanding image size is a nearest-neighbor interpolation, which replaces every pixel in the output with the nearest pixel; for upscaling, this implies many pixels of the same color will be present. This can preserve fine features in pixel art but can bring jaggedness into previously smooth visuals. The 'closest' in the nearest-neighbor does not have to be the mathematical nearest. One frequent implementation is to always round to zero. This method of rounding produces fewer artifacts and is faster to calculate.
Bilinear and bicubic algorithms:
Bilinear interpolation works by interpolating pixel color values, resulting in a continuous transition in the output despite the fact that the original material has discrete transitions. Although this is excellent for continuous-tone images, it may be unfavorable for line art because it diminishes contrast (sharp edges). Bicubic interpolation produces significantly better outcomes at a higher computational cost.
One shortcoming of bilinear, bicubic, and related algorithms is that they only sample a limited number of pixels. When downscaling is less than a particular threshold, such as more than twice for all bi-sampling techniques, the algorithms sample non-adjacent pixels, resulting in both data loss and rough results.
The simplest solution to this problem is box sampling, which involves viewing the target pixel as a box on the original image and sampling all pixels within the box. This ensures that all pixels in the input contribute to the result. The main disadvantage of this algorithm is that it is difficult to optimize.
Another option is vector extraction or vectorization. Vectorization begins by creating a resolution-independent vector representation of the to-be-scaled graphic. The resolution-independent version is then displayed as a raster image at the specified resolution. Adobe Illustrator, Live Trace, and Inkscape all use this technique. Scalable Vector Graphics are ideally suited to simple geometric images, whereas photographs, because to their complexity, do not fair well with vectorization.