Shiny Language Reference

Language Reference > Image Functions


setimagegamma

bool setimagegamma(image MyImage, double Gamma);

 

 

Alters the gamma factor of the image

The SETIMAGEGAMMA statement alters the gamma factor of an image. If you are unfamiliar with gamma ramps, it is similar to (but not the same as) altering both the brightness and the contrast of an image so it appears either lighter or darker, but without altering the overall "tone" of the image. It is often used to make images visible on all monitors (as monitors are manufactured with different brightness tolerances), without altering the image itself.

Gamma values are traditionally specified on a scale from 0.0 to 2.0, where 0.0 is effectively 100% dark, where 1.0 makes no change to the image, and where 2.0 is 100% light.

 

Parameters

MyImage

A variable declared as type IMAGE and previously associated with a bitmap image using the CREATEIMAGE statement.

Gamma

A value from 0.0 to 2.0 specifying the gamma ramp to use. Specifying values outside this range causes the statement to be ignored. Specifying 1.0 for this parameter has no effect on the image.

 

Return Value

True if altering the gamma succeeded, otherwise False.

 

Example Code

image MyImage;
if(createimage(MyImage, "C:\\MyBitmap.bmp") == TRUE)
{
    // Darken the image
    setimagegamma(MyImage, 0.8);
}