If you don't care about alpha/extra channels, you can remove them from the image before doing pixel access. Of course, keep in mind that if you then save the image, the saved image will not contain these channels. It's easy to remove alpha/extra channels by using the color space converter. For example:
Copy Code
|
|
---|---|
// Removes any alpha/extra channels from the image void removeAlphaExtra(HIGEAR hImage) { // Make sure there's at least one alpha or extra channel // (this isn't strictly necessary, it's here for demo purposes) enumIGColorSpaceIDs cs; IG_image_colorspace_get(hImage, &cs); if (!IG_util_colorspace_contains_alpha(cs) && !IG_util_colorspace_contains_extra(cs)) return; // Alter the color space ID to only include color channels cs = (enumIGColorSpaceIDs) (cs & IG_COLOR_SPACE_ID_ColorMask); // Use the color space converter to convert to this new ID IG_image_colorspace_convert(hImage, cs, NULL); } |