Changing the gamma of an image consists in modifying the value gamma in:

**(R',G',B') = (R**^{ɣ}, G^{ɣ}, B^{ɣ})

which gives the output pixel color (R',G',B') displayed on the screen after applying the gamma function to the initial pixel values (R,G,B) (considering R,G, and B normalized between 0 and 1).

Now, let's take the red channel for example.

If **R = R0+R1** , you will obtain

**R' = (R0+R1)**^{ɣ} = R0^{ɣ} * (1+R1/R0)^{ɣ}

If R0 is much bigger than R1, then you have

**(1+R1/R0)**^{ɣ} ≈ 1 + ɣ*R1/R0,

so **R' ≈ R0**^{ɣ} + ɣ*R1*R0^{ɣ-1}

This means that for gamma close to 0, R0^{ɣ} dominates. For ɣ=1, you get

**R' ≈ R0 + R1**

Fo a large gamma, the second term dominates, so that you can directly setup R0 = red component of the pear and R1 = red component of the apple, with R0 much larger than R1 and you will obtain the desired variations when changing the gamma of your monitor (or the particular gamma curve each software uses).