NAME

zoom - Methods to Resize an Image


SYNOPSIS

magnify_image= MagnifyImage( image, ExceptionInfo *exception );

Image * MinifyImage( Image *image, ExceptionInfo *exception );

Image * ResizeImage( Image *image, const unsigned int columns, const unsigned int rows, const FilterType filter, const double blur, ExceptionInfo *exception );

Image * SampleImage( Image *image, const unsigned int columns, const unsigned int rows, ExceptionInfo *exception );

Image * ScaleImage( Image *image, const unsigned int columns, const unsigned int rows, ExceptionInfo *exception );

Image * ZoomImage( Image *image, const unsigned int columns, const unsigned int rows, ExceptionInfo *exception );


FUNCTION DESCRIPTIONS

MagnifyImage

Method MagnifyImage creates a new image that is a integral size greater than an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

MagnifyImage scans the reference image to create a magnify image by bilinear interpolation. The magnify image columns and rows become:

  number_columns << 1
  number_rows << 1

The format of the MagnifyImage method is:

magnify_image=MagnifyImage ( image, ExceptionInfo *exception );

A description of each parameter follows:

magnify_image:
Method MagnifyImage returns a pointer to the image after magnification. A null image is returned if there is a memory shortage.

image:
The address of a structure of type Image.

exception:
return any errors or warnings in this structure.

MinifyImage

Method MinifyImage creates a new image that is a integral size less than an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

MinifyImage scans the reference image to create a minified image by computing the weighted average of a 4x4 cell centered at each reference pixel. The target pixel requires two columns and two rows of the reference pixels. Therefore the minified image columns and rows become:

  number_columns/2
  number_rows/2

Weights assume that the importance of neighboring pixels is negately proportional to the square of their distance from the target pixel.

The scan only processes pixels that have a full set of neighbors. Pixels in the top, bottom, left, and right pairs of rows and columns are omitted from the scan.

The format of the MinifyImage method is:

Image *MinifyImage ( Image *image, ExceptionInfo *exception );

A description of each parameter follows:

minify_image:
Method MinifyImage returns a pointer to the image after reducing. A null image is returned if there is a memory shortage or if the image size is less than IconSize*2.

image:
The address of a structur of type Image.

exception:
return any errors or warnings in this structure.

ResizeImage

Method ResizeImage creates a new image that is a scaled size of an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. The Point filter gives fast pixel replication, Triangle is equivalent to bi-linear interpolation, and Mitchel giver slower, very high-quality results. See Graphic Gems III for details on this algorithm.

The format of the ResizeImage method is:

Image *ResizeImage ( Image *image, const unsigned int columns, const unsigned int rows, const FilterType filter, const double blur, ExceptionInfo *exception );

A description of each parameter follows:

resize_image:
Method ResizeImage returns a pointer to the image after scaling. A null image is returned if there is a memory shortage.

image:
the address of a structure of type Image.

columns:
an integer that specifies the number of columns in the resize image.

rows:
an integer that specifies the number of rows in the scaled image.

filter:
specifies which image filter to use.

blur:
specifies the blur factor where > 1 is blurry, < 1 is sharp.

exception:
return any errors or warnings in this structure.

SampleImage

Method SampleImage creates a new image that is a scaled size of an existing one using pixel sampling. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

The format of the SampleImage method is:

Image *SampleImage ( Image *image, const unsigned int columns, const unsigned int rows, ExceptionInfo *exception );

A description of each parameter follows:

sample_image:
Method SampleImage returns a pointer to the image after scaling. A null image is returned if there is a memory shortage.

image:
The address of a structure of type Image.

columns:
An integer that specifies the number of columns in the sampled image.

rows:
An integer that specifies the number of rows in the sampled image.

exception:
return any errors or warnings in this structure.

ScaleImage

Method ScaleImage creates a new image that is a scaled size of an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. To scale a scanline from x pixels to y pixels, each new pixel represents x/y old pixels. To read x/y pixels, read (x/y rounded up) pixels but only count the required fraction of the last old pixel read in your new pixel. The remainder of the old pixel will be counted in the next new pixel.

The scaling algorithm was suggested by rjohnson@shell.com and is adapted from pnmscale(1) of PBMPLUS by Jef Poskanzer.

The format of the ScaleImage method is:

Image *ScaleImage ( Image *image, const unsigned int columns, const unsigned int rows, ExceptionInfo *exception );

A description of each parameter follows:

scale_image:
Method ScaleImage returns a pointer to the image after scaling. A null image is returned if there is a memory shortage.

image:
The address of a structure of type Image.

columns:
An integer that specifies the number of columns in the scaled image.

rows:
An integer that specifies the number of rows in the scaled image.

exception:
return any errors or warnings in this structure.

ZoomImage

Method ZoomImage creates a new image that is a scaled size of an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. The Point filter gives fast pixel replication, Triangle is equivalent to bi-linear interpolation, and Mitchel giver slower, very high-quality results. See Graphic Gems III for details on this algorithm.

The filter member of the Image structure specifies which image filter to use. Blur specifies the blur factor where > 1 is blurry, < 1 is sharp.

The format of the ZoomImage method is:

Image *ZoomImage ( Image *image, const unsigned int columns, const unsigned int rows, ExceptionInfo *exception );

A description of each parameter follows:

zoom_image:
Method ZoomImage returns a pointer to the image after scaling. A null image is returned if there is a memory shortage.

image:
The address of a structure of type Image.

columns:
An integer that specifies the number of columns in the zoom image.

rows:
An integer that specifies the number of rows in the scaled image.

exception:
return any errors or warnings in this structure.