# Thread: Total number of possible JPEG's

1. ## Total number of possible JPEG's

Hi, I'm trying to compute the total number of possible JPEG's that could be created.
JPEGs can be anywhere from 1x1 to 65535x65535 pixels and each pixel has 8bit color x three color channels. This means there is 256x256x256=16777216 possibilities for each pixel.
I'm an amateur at mathematics, but so far what I have come up with is:

(256^3)^(sum_(x=0)^65535(x+sum_(y=0)^65535y))

I figured I had to sum the maximum width of the jpeg (65535) added to the summation of the maximum height (also 65535) to get the total number of possible sizes. Then I would have to use that total (the total amount of possible pixel spaces) as an exponent on the number of possible colors right?

Any help would be greatly appreciated (in solving the equation, verifying it, or correcting it)!
Thanks!

-John G. Hampton

2. ## Re: Total number of possible JPEG's

its probable easiest to build up to this. Suppose i fix the dimensions at x and y. Lets find the number of $x \times y$ JPEGs that can be made.

There are xy pixels, and each one can take 256^3 values. So the number is $\left(256^3 \right)^{xy} = 256^{3xy}$

Step 2
Now lets vary one of the dimensions (x), while pretending the other(y) is fixed at some value. We can just add up our formula for all the possible values of x

Combinations if height is fixed at y : $\sum_{x=1}^{65535} 256^{xy}$

Step 3
Now lets vary the other dimension. We can just add up the previous formula for all the possible values of y.

$\sum_{y=1}^{65535} \left( \sum_{x=1}^{65535} 256^{3xy} \right)$

3. ## Re: Total number of possible JPEG's

Those calculations are right for bitmap/raw pictures. But then JPEG uses the DCT to achieve lossy compression, so all possible quantization matrix values combinations affecting the DCT should be taken into account too, shouldn't it? Effectively counting each smallest possible compression factor variation affecting high and low frequencies of the image as the generator of a unique variation of source image to be counted as if it was a new image. Or not?

4. ## Re: Total number of possible JPEG's

Thanks for the replies!
You bring up a good point Chojin. You're right, this is just a calculation for a bitmap of each possible jpeg image, but I think I can get away with this because this calculation is to figure out how many variations on the JPEG could be printed (assuming uniformity in the printing processes). It should cover all possible artifacting from various levels of compression—at least visually.

Now if only I could solve it! It's far too large for wolfram-alpha which is my usual calculator.