Automatic Gamma Correction Best Practices

The automatic gamma correction method chooses a gamma value based on the file type when loading a bitmap file (in certain cases) and when saving a bitmap file. You do not need to care about the gamma correction because it is automatically done based on the file type, bit depth, and other properties.

Following are the limitations in the previous method for gamma correction:

In the automatic gamma correction method, if a file header does not contain a gamma value, the file type is considered to determine whether the file must be stored linearly. For more information about automatic gamma correction, see the Automatic Gamma Correction topic.

The mapping of the flags (BMM_CUSTOM_FILEGAMMA and BMM_CUSTOM_GAMMA) with the gamma options in the File dialog has changed in the automatic gamma correction method. Additionally, the meaning of the BMM_CUSTOM_FILEGAMMA flag has also changed. A new BitmapIOMetaData interface in the BitmapIO class is used to determine whether the file types are saved and loaded linearly or with an embedded gamma. For more information about the SDK changes, see the SDK Changes for Automatic Gamma Correction topic.

Best Practices

Following are some best practices for avoiding gamma related issues when writing code: