1. How many pictures calculator

How do you work out how many pictures there are for a given number of pixels and colours?

The image dimensions are 1 Bit Per Pixel = 2 colours 4*4 number of pixels = 16 pixels

I think the answer is 2^16 = 65536 2 to power of 16 is 65536 Is this the correct answer?

new topic     » topic index » view message » categorize

2. Re: How many pictures calculator

Here is the code I’m using to produce all the pictures

 
include misc.e 
include get.e 
 
constant NUMOFBITS=16 
constant START=0 
constant TARGET=1 
 
sequence bits 
bits=repeat(0,NUMOFBITS) 
 
integer fn 
fn=open("data.txt","w") 
 
integer pos1 
pos1=NUMOFBITS 
 
sequence result 
result=repeat(TARGET,NUMOFBITS) 
 
while 1 do 
   
  puts(fn,sprint(bits)&"\n") 
 
  if equal(bits,result) then 
    exit 
  end if 
 
  bits[pos1]+=1 
 
  if bits[pos1]>TARGET then 
    bits[pos1]=START 
    pos1-=1 
  
    for i=pos1 to 1 by -1 do 
      bits[i]+=1 
      if bits[i]>TARGET then 
        bits[i]=START 
      else 
        pos1=NUMOFBITS 
        exit 
      end if 
    end for 
  end if 
 
end while 
 
close(fn) 
new topic     » goto parent     » topic index » view message » categorize

3. Re: How many pictures calculator

gaz said...

How do you work out how many pictures there are for a given number of pixels and colours?

The image dimensions are 1 Bit Per Pixel = 2 colours 4*4 number of pixels = 16 pixels

I think the answer is 2^16 = 65536 2 to power of 16 is 65536 Is this the correct answer?

I think you are trying to find out ... given P pixels, and each pixel can have C different colours, how many different images can you get?

Well, let's look at the simplest case: P = 1, C = 2 => 2 images. Now when P = 2, we get 2 * 2 = 4 images, when P = 3 we get 2 * 4 = 8 images, etc ...

Graphically ...

P = 1

0 
1 
P = 2
00 
01 
10 
11 
P = 3
000 
001 
010 
011 
100 
101 
110 
111 

Mathemtically ... P = 1 => C, P = 2 => C * C, P = 3 => C * C * C

So in the general case, the number of images is C multiplied by itself P times, which is C raised to the power P.

I = power(C,P) 

In your example data ...

I = power(2,16) 

Gives us the answer 65536.

So if we had an 8 by 8 pixel image (64 pixels per image) and each pixel can have 8 bits each of Red, Green and Blue for a total of 16777216 different colours, we can have about ... 2.4e+462 images (that's 24 followed by 461 zeros).

new topic     » goto parent     » topic index » view message » categorize

4. Re: How many pictures calculator

Thank you DerekParnell

new topic     » goto parent     » topic index » view message » categorize

5. Re: How many pictures calculator

DerekParnell said...

So if we had an 8 by 8 pixel image (64 pixels per image) and each pixel can have 8 bits each of Red, Green and Blue for a total of 16777216 different colours, we can have about ... 2.4e+462 images (that's 24 followed by 461 zeros).

And there are only 10^80 atoms in the observable universe. Wow! grin

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu