My Images Need to be Larger or Smaller
While the concept of "size" in a digital image is somewhat ambiguous, most often when people want to make their images larger or smaller, they want to re-sample the images to change the number of pixels in the image. The most basic way to change the number or pixels in the image is to use the Rescale method. The rescale operation takes a horizontal and a vertical magnification amount, which are typically set to the same value to preserve the aspect ratio. Values of greater than 1.0 will make the image larger, while values of less than 1.0 will make the image smaller. To make an image 50% larger, for example, set the magnification values to 1.5; to make the image 1/3 smaller, set the magnification values to .6667.
Scaling is done differently for continuous tone and bitonal images; scaling of continuous tone images blends the colors of adjacent pixels together to get a new color for the result. This blending is not possible with bitonal images, so they must choose black or white. This limitation means that scaling bitonal images up in size tends to result in blocky images. There is a special option available for doubling the size of bitonal images, called SmoothZoom. This operation has special rules for zooming each possible 2 x 3 block of input pixels. The resulting output rounds off some of the corners which is more visually pleasing.
Sometimes, rather than resampling the image to change the scaling, the size needs to be changed by adding or removing pixels from the image without rescaling. The GetRectangle method can be used to extract just a given rectangle of data from the image, or, if provided with coordinates specifying a rectangle outside the original image, be used to add pixels of the pad color. If the image is not consistently positioned, then RemoveBorder or RegisterImage can be used to remove margins of the image. In the case of a dark border, RemoveBorder can be used to remove the black areas around the edge of the image. With white borders, RegisterImage can be used to remove the white around the data.