How images are stored in LUNA

When considering how much storage you will need for LUNA, it's important to understand how images are stored in LUNA. We do not just store one image for the image you upload. We store up to 6 images. 5 Jpegs and one Jpeg 2000 (JP2K or jp2) file. We do this for several reasons
  • Speed up image delivery 
  • Speed up page load
  • Minimize server processing load
The sizes are as follows: 
  • Size0 - 96 pixels on long side
  • Size1 - 192 pixels on long side
  • Size2 - 384 pixels on long side
  • Size3 - 768 pixels on long side
  • Size4 - 1536 pixels on long side
  • Jpeg 2000 Anything above 1536 pixels on long side will create a JP2K file


So for example if you had a small image and it was 500 pixels on the long side. The Uploader would create Size0 to Size3 and the Size3 would be the size of the original image. So think of these as size bins. If an image is larger than the size bin limit, like 384 in this case, it gets stored in the next larger bin.  Once it goes above 1536, we make a JP2K file.

We also compress the images at a conservative rate. This keeps compression artifacts from being visible on all the varied material that gets loaded into the LUNA systems. Compression, however,  does not make images all the same size. It varies based on the complexity of the detail in an image. If there is a scene with large areas like a sky with very minor variations, it will compress much better than a scene with a tree containing lots of leaves and variance. So we can not give absolutes about how content will compress and be stored. 

Another consideration is that when we compress a 20 MB uncompressed source files(tiffs). These are always over 1536 pixels on the long side. So all the base images are generated as well as the JP2K file.
If you had a 100 MB source file or a 20 MB source file, they will both have the base (size0-4) images plus one JP2K file. The JP2K files compress around 10:1 to 15:1. So bigger images get more compression benefit than smaller images do. 
You can also upload JP2K files of your own. The Uploader will then generate the size0-4 jpegs and keep your original JP2K file.

Books in LUNA

Books are a little different. In LUNA each page of a book is converted into a JP2K file. So it compresses each page in that manner. So say one page uncompressed is a 20MB file. That means it will probably be stored on the LUNA server as a 250KB to ~2MB JP2K file. So a 300 page book may take up 100-600 MB. This all depends on how much whitespace is on the pages. The more whitespace, the more compressed the page will be. The more detail the lager the JP2K file will be.

Also for books there is only one thumbnail created for the book. This will save space as well.

So you can not compare this to a PDF file. PDF's use a number of tricks to store the pages highly compressed.