All JPGS, pngs etc are basically just sequences of bits. Is it possible to generate these by making a program that generates random sequences of bits?

For example say that the sequence 100010111 is all the bits used to store a picture of mona lisa taken by a tourist on a disk. This sequence would be easy for a computer to randomly generate by trying all the alternatives from with the given bit sequence. If you had a extremely powerful CPU you could generate images longer than this as well.

Is it theoretically possible to generate all photos taken, and all that ever will be taken using this method? With Moores law, how long is it till we get a computer that can generate photos of a somewhat low quality < 1mpixel?

closed as off-topic by rjzii, Suma, Tom77, Oddthinking Jul 23 '13 at 12:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I don't think this question is a good fit for this site. You should take it to maybe – Jens Jul 23 '13 at 11:53
  • 5
    It would be relatively easy to generate all possible 16x16 true color icons, but still this is not a way icons are created. As S. Lem has wrote about Demon of the Second Kind in The Cyberiad, there is more difficult problem than the random sequence generation - evaluation of the pictures. It is easy to generate insane amounts of data, but how will you select those which are "interesting" or "good"? Will there be a human evaluating each picture? – Suma Jul 23 '13 at 12:17
  • 8
    This is like the idea that a lot of monkeys with typewriters could eventually produce the works of Shakespeare. Aside from taking a laughably long time, they would also produce every possible misspelling of those, not to mention all the banal and bawdy literature, buried in a sea of utter gibberish. – Mike Dunlavey Jul 23 '13 at 13:46
  • 1
    @userunknown, You are correct, the number of possible 16x16 icons is much huger than I expected, I have made a mistake in my "back of the envelope" calculation. Still, the rest holds: selecting the "good" images is even more difficult than generating random ones. Moreover, I think even your number is wrong, I think the correct number is 2^(16*16*24), which is 3.37e1849. Even generating 8x8 of 8b icons would take too long (1.3e154) possibilities. – Suma Jul 23 '13 at 19:36
  • 1
    There is a very profound issue here which, I think, justifies inclusion on this site. The issue is the distinction between possible and practical. It is easy to write an algorithm to solve the problem; but in a finite universe the answer is impossible to reach. The distinction between possible in theory and possible in reality is important in many arguments and worth recording here. – matt_black Jul 23 '13 at 20:52
up vote 14 down vote accepted

Yes. But let's keep PNG or JPG out of the picture since they're quite complex formats. If we'd talk about a simple bitmap it's much easier.

If you keep increasing one number (1, 2, 3, 4) and then another number everytime from 1 up to that number you get a sequence like this:

1 1
2 1
2 2
3 1
3 2
3 3
4 1

This is respectively the width and height of your picture. If you then loop through all of those pictures with every pixel set to black, and go through every possible color for every pixel combination until you get an all-white picture you will eventually generate every picture.

However this will take an extremely long time. Say we want to generate every picture with one megapixel. Let's say a pixel has a bit-depth of 8 bits for each RGB channel so a total of 24 bits per pixel. That means one pixel has 224 possible colours. Two pixels have 224 × 224 combinations. One megapixel has 224000000 possible combinations (excluding different width/height combinations). If we would generate a million images per second on a computer, one person has one million computers, one country has one million persons, a planet has one million countries, a sun has one million planets, a galaxy has one million suns and the universe has a million galaxies it would still take 107224567 googol centuries to generate every megapixel image.

  • Voted up for being the answer I wanted to give. – medivh Jul 23 '13 at 10:58
  • 3
    The last sentence kind of invalidates the "yes" at the beginning. Besides, to really do this, humanity has to leave earth, since the sun's energy is limited. See (fifth indented paragraph) – Jens Jul 23 '13 at 11:49
  • 2
    @Jens: It's theoretically possible given an unbounded computer - which does not exist in our universe :) I also was more focused on demonstrating mathematically that it is indeed possible, rather than the feasability in physics. – orlp Jul 23 '13 at 14:13

Not the answer you're looking for? Browse other questions tagged .