This function resizes the image referenced by hIGear.
Declaration:
Copy Code | |
---|---|
AT_ERRCOUNT ACCUAPI IG_IP_resize( HIGEAR hIGear, AT_DIMENSION nNewWidth, AT_DIMENSION nNewHeight, AT_MODE nInterpMethod ); |
Arguments:
hIGear | HIGEAR handle of image to resize. |
nNewWidth | Width that the image is to be after resizing. |
nNewHeight | Height that the image is to be after resizing. |
nInterpMethod | Specifies interpolation method to use for image resizing. See enumIGInterpolations for possible values. |
Return Value:
Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.Supported Raster Image Formats:
If nInterpMethod is IG_INTERPOLATION_GRAYSCALE, IG_INTERPOLATION_PRESERVE_WHITE, or IG_INTERPOLATION_PRESERVE_BLACK:
- Indexed RGB - 1 bpp;
- Grayscale - 1 bpp.
If nInterpMethod is IG_INTERPOLATION_AVERAGE or IG_INTERPOLATION_BILINEAR:
All pixel formats supported by ImageGear Professional, except:
- Indexed RGB with non-grayscale palette.
If nInterpMethod is IG_INTERPOLATION_BICUBIC:
All pixel formats supported by ImageGear Professional, except:
- Indexed RGB with non-grayscale palette.
- Grayscale - 1 bpp.
Otherwise, all pixel formats supported by ImageGear Professional.
Sample:
Image Processing, Timing
Example:
Copy Code | |
---|---|
HIGEAR hIGear; // HIGEAR handle of the image AT_ERRCOUNT nErrcount; // Count of errs on stack upon ret from func AT_DIMENSION nWidth, nHeight; // Dimensions of the image // Load image file "picture.bmp" from working directory nErrcount = IG_load_file("picture.bmp", &hIGear); if(nErrcount == 0) { // Get dimensions of the image IG_image_dimensions_get(hIGear, &nWidth, &nHeight, NULL); nErrcount = IG_IP_resize(hIGear, nWidth / 2, nHeight / 2, IG_INTERPOLATION_NONE); // ... // Destroy the image IG_image_delete(hIGear); } |
Remarks:
The image data in the bitmap will be stretched, compressed, or padded as necessary to fit the new dimensions.
During resizing, new pixel values that previously did not exist in the image may be introduced due to interpolation. If you want to prevent this, such as to preserve the original number of palette entries used, then specify IG_INTERPOLATION_NONE. In this case, only pixel values that occur in the original image will result in the resized image.
The functionality of this API call has been upgraded and supported by the new function IG_IP_resize_bkgrnd_ex. This new function allows you to change the background color around the image being resized, if the interpolation is either IG_INTERPOLATION_PADDING or IG_INTERPOLATION_CANVAS. In the interest of backward compatibility, we have left the old function in its original form and have retained support for it. If you have already used the old function in your code, it is not mandatory that you modify your code, but it is recommended. |