Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom Image Format: How to Target Compression Algorithms
    primarykey
    data
    text
    <p>I've done a bit of fiddling around with PNGs over the last couple days and I am upset with my findings. I'm concluding that the majority of my results deal with compression. So this weekend I'm going to dive into advanced compression articles. I wanted to share my findings so far. To see if anyone has any advice on achieving my goal and to maybe point me in the right direction.</p> <p>I am currently working on a project where I need to obtain the smallest possible file size within a window of less than 15 seconds.</p> <p>The majority of the images I am working with are PNG-8bpp with a full 256 color palette. Most of these images I could represent accurately with 5bpp (32 colors). </p> <p>PNG indexed however only supports 1,2,4, and 8bpp. So my idea was to strip the PNG format to the minimal information I needed and write an encoder/decoder to support IDAT sections with 3,5,6, or 7bpp.</p> <pre><code>Test 1: Original File: 61.5KB, 750 * 500, 8pp Palette, 256 colors, No tRNS After Optimizations (Reductions to 4bpp, Strip Anx Chunks, &amp; PNGOUT): 49.2KB 4bpp, 16 Colors Human Interpretation: I can see 6 distinguishable colors. </code></pre> <p>Since I only need six colors to represent the image I decide to encode the IDAT using 3bpp to give me a max palette of 8 colors. First I uncompressed the IDAT which results in a new file size of 368KB. After applying a 3bpp to IDAT my new uncompressed file size is 274KB. I was off to what seemed to be a good start... Next I applied deflate to my new IDAT section. Result... 59KB. </p> <p>10KB larger than using 4bpp.</p> <pre><code>Test 2: Original File: 102KB, 1000 * 750, 8bpp, 256 Colors, tRNS 1 fully transparent color After Optimization: 79KB, 8bpp, 193 colors, tRNS 1 full transparent color Human Interpretation: I need about 24 colors to represent this picture. </code></pre> <p>24 colors can be represented in 5bpp at 32 colors. Using the same technique above I was able to achieve much better results over uncompressed but again I lost at compression. Final size compressed... 84KB. Then I tried at 6,7bpp... same result poorer compression that at 8bpp.</p> <p>Just to be sure I saved all the uncompressed images and tried several other compression algorithms... LZMA, BZIP2, PAQ8... same result smaller compression size at 8bpp than at 5,6, or 7bpp AND smaller size at 4bpp than at 3bpp.</p> <p>Why is this occuring? Can I tweak/modify a compression algorithm to target a PNG like format that uses a 5,6, or 7bpp format that beast 8bpp compression? Is it worth the time... and yes saving another 10KB would be worth it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload