# How many unique images can my monitor display?

**URL:** <https://boards.straightdope.com/t/how-many-unique-images-can-my-monitor-display/854551>\
**Category:** Factual Questions\
**Created:** [May 27, 2020, 5:09pm UTC](https://boards.straightdope.com/t/how-many-unique-images-can-my-monitor-display/854551 "2020-05-27T17:09:02Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![septimus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/septimus/32/410_2.png) [@septimus](https://boards.straightdope.com/u/septimus)\
**Post date:** [May 29, 2020, 11:40am UTC](https://boards.straightdope.com/t/how-many-unique-images-can-my-monitor-display/854551/21 "2020-05-29T11:40:09Z")

</div>

> [@Machine\_Elf](#):
>
> What’s the problem with that line? I’m just starting to learn python, but wouldn’t that that rand command generate a a value between zero and one, inclusive?
> 
> Moreover, the average of all component values from **all** possible 24-bit images of a given height and width must be 127.5, but since any single image is just a sample from that whole population, shouldn’t it be possible for any single image to have an average component value other than 127.5? Afterall, a random image generator is just as likely to create an all-black or all-white image as it is to create the exact image seen at that link.

A uniform number on [0,1] becomes on [0,255] after multiplication by 255. A value like 0.9999999 will become 254.9999745 after the multiplication _ **and will be rounded down to 254** _. Values of 255 will NEVER (or almost never) occur.

_ **The multiplication should be by 256** _, not 255. (Whether this will result in very rare instances of an “illegal” 256 result depends on python library details.)  
If my arithmetic is correct, the std-dev of the uniform {0,1,2,…,255} is about 73.9; so in an 11-million component image (the size of the full image linked from Wikimedia) this means that, if the components are drawn from that distribution, the average component should have a 95% chance of lying between 127.478 and 127.522. (FWIW, I actually checked the image we’re commenting on and determined that, yes, its components had the incorrect 127.0 average, as expected.)

To get an average as low as 127 or as high as 129 (let alone the 0 or 255 values needed for all-black or all-white image) would be a “22.5-sigma event” – VERY unlikely. Producing an all-black image at random is … unlikely.

---

<div class="post-metadata">

**Author:** ![septimus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/septimus/32/410_2.png) [@septimus](https://boards.straightdope.com/u/septimus)\
**Post date:** [May 29, 2020, 11:49am UTC](https://boards.straightdope.com/t/how-many-unique-images-can-my-monitor-display/854551/22 "2020-05-29T11:49:25Z")

</div>

> [@septimus](#):
>
> … the average component should have a 95% chance of lying between 127.478 and 127.522.

Make that a 68% chance.

The component average has a 95% chance of lying between 127.45 and 127.55.

[Previous page](https://boards.straightdope.com/t/how-many-unique-images-can-my-monitor-display/854551.md?page=1)
