I am a bit rusty on math and was wondering if someone could check my back of the envelope calculation.

Each RGB component has values between 0 and 255 inclusive. There are three components so you have $256^3$ possible colors in this format.

That means that for a 2 pixel by 2 pixel image there would be $(256^3)^4$ possible combinations, correct?

Thank you.

  • 1
    $\begingroup$ There are $256$ integers between $0$ and $255$ inclusive. $\endgroup$
    – BrianO
    Jan 30, 2016 at 0:56
  • $\begingroup$ Yes that's correct. There are $256$ ways to choose each R,G and B component, so $256^3$ possibilities per pixel. Thus if there are $N$ pixels, there are $(256^3)^N = 256^{3N}$ possible images of that size. $\endgroup$
    – BrianO
    Jan 30, 2016 at 1:01
  • $\begingroup$ This is correct provided you don't take any weird symmetry considerations into account. $\endgroup$ Jan 30, 2016 at 1:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.