ImageGear for C and C++ on Linux v18.8 - Updated
IG_image_resolution_set
API Reference Guide > Core Component API Reference > Core Component Functions Reference > General Image Functions > IG_image_resolution_set

This function sets the resolution of the image referenced by hIGear.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_resolution_set(
        HIGEAR hIGear, 
        LONG xResNumerator, 
        LONG xResDenominator, 
        LONG yResNumerator, 
        LONG yResDenominator, 
        AT_MODE nUnits
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle to the image.
XResNumerator LONG Sets the x resolution numerator.
XResDenominator LONG Sets the x resolution denominator.
YResNumerator LONG Sets the y resolution numerator.
YResDenominator LONG Sets the y resolution denominator.
nUnits AT_MODE Sets the resolution units for the image. See enumIGResolutionUnits for possible values.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Example:

See the example under the IG_image_resolution_get() function.

Remarks:

ImageGear stores resolution as a pair or rational numbers and a unit specification. This is the method used by several image file formats, which allows storing precise resolution values, rather than their double or float approximations. To set the X resolution of the image to 300 DPI, the numerator can be 300 and the denominator 1 (900 and 3 would also work).

When an image is saved to a file, resolution will be converted when necessary to match the units supported by the file format.

ImageGear uses resolution information when printing the image. The ratio of image resolutions (X and Y) can also be used by ImageGear when displaying the image. Use IG_dspl_PPM_correct_set to specify whether ImageGear should use the ratio of image resolutions when displaying and printing the image.

Changing these values does not alter the number of pixels or colors in the actual image in any way. Use IG_IP_resize() and IG_IP_crop() to resize or crop an image.

Use IG_image_resolution_get to obtain the image resolution information.

Use IG_util_resolution_units_convert to convert resolution to different units.