Dzung Nguyen
Dzung Nguyen

Reputation: 3944

Set default value for alpha in CImg

I need to load an RGB image into RGBA form in CImg (R1R2R3 G1G2G3 B1B2B3 A1A2A3 etc) and the get im.data() properly. For now Cimg is reading RGB only (R1R2R3 G1G2G3 B1B2B3). How do I add the alpha channels to the image with default value of 255?

Upvotes: 0

Views: 711

Answers (1)

bvalabas
bvalabas

Reputation: 116

like this:

img.channels(0,3);                   // Force 4th channel.
img.get_shared_channel(3).fill(255); // Fill it with 255.

Upvotes: 2

Related Questions