View Question
Q: Mathematical algorithm for generating graphics for possible pixel combinations ( No Answer,   1 Comment )
 Question
 Subject: Mathematical algorithm for generating graphics for possible pixel combinations Category: Computers > Algorithms Asked by: mrfresh-ga List Price: \$5.00 Posted: 08 Jun 2006 04:54 PDT Expires: 09 Jun 2006 05:22 PDT Question ID: 736367
 ```An image of totally 4 pixels (2px*2px) has a total of 16 different combinations in a colordepth of 2 colors (black/white). The mathematical formula of this statement should be: (x*y)^c where "x" is horizontal image size in pixels where "y" is vertical image size in pixels where "c" is colordepth (2*2)^2 = 16 Imagine an archive of all image combinations in 32*32 pixels of black and white. (32*32)^2 = 1 048 576 I want to process this task on my desktop by software like Macromedia Director or something similar, but having troubles finding a correct algorithm for this. Could you please help me? Thanks, Albert```
 ```I think the math is backwards in your estimate of the number of images you could have. Each image will have 32*32=1024 pixels, each of which can have 2 colors (black or white). So there are 2^(32*32) possible images, which is about 1.8*10^308 images, more than you could ever store on your web server. If you want to pick among these images at random, your best bet would be to write a script on your web server that will generate a random 1024-bit number (or 32 random 32-bit integers). Then you could use a gif library or some custom code to return a .gif or .bmp file which uses all the random bits as the pixels of an image.```