This function resizes the image referenced by hIGear.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_IP_resize( HIGEAR hIGear, AT_DIMENSION nNewWidth, AT_DIMENSION nNewHeight, AT_MODE nInterpMethod ); |
Name | Type | Description |
---|---|---|
hIGear | HIGEAR | HIGEAR handle of image to resize. |
nNewWidth | AT_DIMENSION | Width that the image is to be after resizing. |
nNewHeight | AT_DIMENSION | Height that the image is to be after resizing. |
nInterpMethod | AT_MODE | Specifies interpolation method to use for image resizing. See enumIGInterpolations for possible values. |
If nInterpMethod is IG_INTERPOLATION_GRAYSCALE, IG_INTERPOLATION_PRESERVE_WHITE, or IG_INTERPOLATION_PRESERVE_BLACK:
If nInterpMethod is IG_INTERPOLATION_AVERAGE or IG_INTERPOLATION_BILINEAR:
All pixel formats supported by ImageGear for C and C++, except:
If nInterpMethod is IG_INTERPOLATION_BICUBIC:
All pixel formats supported by ImageGear for C and C++, except:
Otherwise, all pixel formats supported by ImageGear for C and C++.
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); } |
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.