<p>If I get correctly what you are asking you basically just need to find the G in this equation: </p>

<p>$$Image_{out} = Image_{in}^G$$</p>

<p>This could be easily solved as </p>

<p>$$G = \frac{\log{Image_{out}}}{\log{Image_{in}}}$$</p>

<p>Because usually gamma is applied in a uniform fashion on the image, you can just pick any two non zero pixel values (one for source and one for destination) to find out the gamma value applied.  </p>

<p>EDIT: As @ChristianRau pointed out, if you don't actually know if the image has been modified with gamma correction, you have to take an higher amount of samples and trying to fit a gamma function on those. If a fit to a gamma function results in too many significant outliers, then probably gamma correction wasn't the function applied. </p>

CC BY-SA 3.0
2015-08-06T14:07:57.013Z
Though, I think part of his problem as posed in the question is also that he might not know if it is gamma corrected in any way at all or if the colors were not otherwise (linearly or whatever) modified in contrast to mere gamma correction. But ok, in this case you just take a bigger sample size and try to see if it can be approximated sufficiently well with a gamma transformation.
Christian Rau
CC BY-SA 3.0
2015-08-06T14:27:07.320Z
Exactly @ChristianRau, ideally it is to determine the difference even when other color transformations were applied. Thanks cifz, so if you sample several of each image's pixels and the resulting G is approximately 1, then we can conclude that no gamma correction was made?
Armfoot
CC BY-SA 3.0
2015-08-06T14:35:32.827Z
If also the other transformations are unknown, then to my limited knowledge I don't know how and if you can find the gamma. Intuitively I'd say you can't
cifz
CC BY-SA 3.0
2015-08-06T14:45:00.293Z
As @ChristianRau correctly said, you can try and fit the combination of transformations into a gamma function, but that will not tell you what gamma was applied on top of the other unknown transform, but rather an gamma that once applied to the source will give you roughly your destination
cifz
CC BY-SA 3.0
2015-08-06T14:04:38.327Z
2015-11-03T14:47:58.327Z
2015-11-03T14:47:58.327Z
cifz
<p><a href="https://computergraphics.stackexchange.com/questions/68/is-gamma-still-important-to-take-into-account">Trichoplax question</a> aroused my curiosity and <a href="https://graphicdesign.stackexchange.com/questions/11445/gamma-vs-brightness-any-difference">the answers in this question</a> also reminded me why I sometimes use different gamma "amounts" to enhance images.</p>

<p>Therefore, is it possible to determine the amount of gamma applied to an image by knowing its source (the original image)? I.e. can the mathematical formula be applied to compare two images and determine the difference in gamma "amount"?</p>

<p>Example: which of the following have a different gamma amount (I'll give you a non-edible cookie if you find out, and sorry trichoplax for snatching <a href="https://i.sstatic.net/iukw5.png?s=328&amp;g=1" rel="nofollow noreferrer">your ball</a>):</p>

<p><a href="https://i.sstatic.net/msMpT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/msMpT.png" alt="t_1"></a><a href="https://i.sstatic.net/qMPrK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qMPrK.png" alt="t_2"></a><a href="https://i.sstatic.net/5GsqI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5GsqI.png" alt="t_3"></a><a href="https://i.sstatic.net/NxJLB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NxJLB.png" alt="t_4"></a></p>

CC BY-SA 3.0
2015-08-06T13:55:01.850Z
Do you mean you have both the pre and post gamma images and you want to find the gamma applied?
cifz
CC BY-SA 3.0
2015-08-06T13:56:52.307Z
@cifz Yes, the original image is from [trichoplax's profile](https://i.sstatic.net/iukw5.png?s=328&g=1).
Armfoot
CC BY-SA 3.0
2015-08-06T18:26:47.613Z
I don't know for certain that the [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/) licence applies to profile images, but I operate under the assumption that anything that I use as an avatar is automatically licensed that way, and in any case I'm very happy for the image to be reused :)
trichoplax is on Codidact now
CC BY-SA 3.0
2015-08-06T18:42:05.193Z
[Meta Stack Exchange](http://meta.stackexchange.com/questions/176253/profile-images-with-copyright/176256#176256) suggests that profile images are also CC BY-SA 3.0 so as long as you give credit you should be OK using anyone's avatar (provided they complied with the requirement to not post works they don't have the right to...).
trichoplax is on Codidact now
<color><gamma><brightness><image-comparison>
Brightness and contrast VS Gamma, is it possible to identify the gamma "correction amount"?
Armfoot
# Brightness and contrast VS Gamma, is it possible to identify the gamma "correction amount"?

(Asked by: username_0 on 2015-08-06)

[username_2 question](https://computergraphics.stackexchange.com/questions/68/is-gamma-still-important-to-take-into-account) aroused my curiosity and [the answers in this question](https://graphicdesign.stackexchange.com/questions/11445/gamma-vs-brightness-any-difference) also reminded me why I sometimes use different gamma "amounts" to enhance images.

Therefore, is it possible to determine the amount of gamma applied to an image by knowing its source (the original image)? I.e. can the mathematical formula be applied to compare two images and determine the difference in gamma "amount"?

Example: which of the following have a different gamma amount (I'll give you a non-edible cookie if you find out, and sorry username_2 for snatching [your ball](https://i.sstatic.net/iukw5.png?s=328&g=1)):

[![t_1](https://i.sstatic.net/msMpT.png)](https://i.sstatic.net/msMpT.png)[![t_2](https://i.sstatic.net/qMPrK.png)](https://i.sstatic.net/qMPrK.png)[![t_3](https://i.sstatic.net/5GsqI.png)](https://i.sstatic.net/5GsqI.png)[![t_4](https://i.sstatic.net/NxJLB.png)](https://i.sstatic.net/NxJLB.png)

**Tags:** color, gamma, brightness, image-comparison

> **Comments:**
> **username_1**: Do you mean you have both the pre and post gamma images and you want to find the gamma applied?  
> **username_0**: @username_1 Yes, the original image is from [username_2's profile](https://i.sstatic.net/iukw5.png?s=328&g=1).  
> **username_2**: I don't know for certain that the [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/) licence applies to profile images, but I operate under the assumption that anything that I use as an avatar is automatically licensed that way, and in any case I'm very happy for the image to be reused :)  
> **username_2**: [Meta Stack Exchange](http://meta.stackexchange.com/questions/176253/profile-images-with-copyright/176256#176256) suggests that profile images are also CC BY-SA 3.0 so as long as you give credit you should be OK using anyone's avatar (provided they complied with the requirement to not post works they don't have the right to...).  

---

## 1 answers

### Answer by username_1 on 2015-08-06. Score: 6

If I get correctly what you are asking you basically just need to find the G in this equation:

$$Image\_{out} = Image\_{in}^G$$

This could be easily solved as

$$G = \frac{\log{Image\_{out}}}{\log{Image\_{in}}}$$

Because usually gamma is applied in a uniform fashion on the image, you can just pick any two non zero pixel values (one for source and one for destination) to find out the gamma value applied.

EDIT: As @username_3 pointed out, if you don't actually know if the image has been modified with gamma correction, you have to take an higher amount of samples and trying to fit a gamma function on those. If a fit to a gamma function results in too many significant outliers, then probably gamma correction wasn't the function applied.

> **Comments:**
> **username_3**: Though, I think part of his problem as posed in the question is also that he might not know if it is gamma corrected in any way at all or if the colors were not otherwise (linearly or whatever) modified in contrast to mere gamma correction. But ok, in this case you just take a bigger sample size and try to see if it can be approximated sufficiently well with a gamma transformation.  
> **username_0**: Exactly @username_3, ideally it is to determine the difference even when other color transformations were applied. Thanks username_1, so if you sample several of each image's pixels and the resulting G is approximately 1, then we can conclude that no gamma correction was made?  
> **username_1**: If also the other transformations are unknown, then to my limited knowledge I don't know how and if you can find the gamma. Intuitively I'd say you can't  
> **username_1**: As @username_3 correctly said, you can try and fit the combination of transformations into a gamma function, but that will not tell you what gamma was applied on top of the other unknown transform, but rather an gamma that once applied to the source will give you roughly your destination  

---

