3

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?

bogen
  • 351
  • 1
  • 8
  • 1
    I don't think this question is a good fit for this site. You should take it to maybe math.stackexchange.com – 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](http://everything2.com/title/Demon+of+the+Second+Kind) in [The Cyberiad](http://en.wikipedia.org/wiki/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
  • @MikeDunlavey except the monkeys would be more of an analogue system, and many many times more difficult improbable. Also, wasn't the infinite monkeys debunked? – AthomSfere Jul 23 '13 at 13:57
  • See also http://skeptics.stackexchange.com/questions/4508/can-every-grain-of-sand-be-addressed-in-ipv6 which talks about 128-bit IP6 addresses. Your "megapixel" images are at least a million bits instead of 128 bits, and exponentially larger. – ChrisW Jul 23 '13 at 17:35
  • @suma: 16*16 pixel of 24 bit each, that would be 6277101735386680763835789423207666416102355444464034512896 possibilities - I'd like to see you generating all those with you home PC. And that's just the small 16x16 pics. – user unknown Jul 23 '13 at 17:49
  • 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
  • @Suma: Yes, you're right. – user unknown Jul 23 '13 at 19:55
  • 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
  • @matt_black i agree. What should i do to remove the on hold status? – bogen Jul 23 '13 at 21:24
  • @matt_black What would the "claim widely heard or read be then"? While I agree "distinction between possible in theory and possible in reality is important", I still do not think it makes this question good fit for this site. – Suma Jul 24 '13 at 06:14
  • @Hakonbogen you should add a reference to somebody having made the claim you want challenged, and preferably quote that claim. –  Jul 25 '13 at 16:48
  • @suma Widely believed claim that infinite number of monkeys could write shakespeare is essentially equivalent to this. Frequently and incorrectly used in probability arguments about evolution. – matt_black Jul 26 '13 at 20:57

1 Answers1

14

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.

vartec
  • 26,581
  • 5
  • 97
  • 155
orlp
  • 255
  • 2
  • 6
  • Voted up for being the answer I wanted to give. – shieldfoss 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 http://www.schneier.com/blog/archives/2009/09/the_doghouse_cr.html (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