Changed license to CC0
[imagesqueeze.git] / doc / index.org
1 #+TITLE: ImageSqueeze - lossy image codec
2 * (document settings) :noexport:
3 ** use dark style for TWBS-HTML exporter
4 #+HTML_HEAD: <link href="https://bootswatch.com/3/darkly/bootstrap.min.css" rel="stylesheet">
5 #+HTML_HEAD: <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
6 #+HTML_HEAD: <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
7 #+HTML_HEAD: <style type="text/css">
8 #+HTML_HEAD:   footer {background-color: #111 !important;}
9 #+HTML_HEAD:   pre {background-color: #111; color: #ccc;}
10 #+HTML_HEAD: </style>
11
12 * General
13 - This program is free software: released under Creative Commons Zero
14   (CC0) license
15
16 - Program author:
17   - Svjatoslav Agejenko
18   - Homepage: https://svjatoslav.eu
19   - Email: mailto://svjatoslav@svjatoslav.eu
20
21 - [[https://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]]
22
23 ** Source code
24 - [[https://www2.svjatoslav.eu/gitweb/?p=imagesqueeze.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]]
25
26 - [[https://www2.svjatoslav.eu/gitweb/?p=imagesqueeze.git;a=summary][Browse Git repository online]]
27
28 - Clone Git repository using command:
29   : git clone https://www2.svjatoslav.eu/git/imagesqueeze.git
30
31 * Overview
32 Lossy image codec. Optimized for photos. I developed it to test out an
33 image compression ideas.
34
35 I believe my [[id:1d917f74-e763-4a71-976e-4aa60732efa6][algorighm has interesting advantages.]]
36
37 Below are original photo and the same image being compressed down to
38 ~93 Kb and then decompressed.
39
40 [[file:originalAndCompressed.png]]
41
42 When looking very closely, slight grainyness, loss of color precision
43 and blurriness (loss of detail) could be noticed as a compression
44 artifacts. Still sharp edges are always preserved. Also no blocks
45 typical to JPEG are ever seen.  I think that is awesome result for
46 just ~ 2.5 bits per pixel on that color photo.
47 * Algorithm description
48 + Color image is split into three separate channels: Y, U and V.
49   + Each channel is independently compressed.
50
51 + Single channel compression method:
52
53   + Algorithm is inspired by [[https://en.wikipedia.org/wiki/Diamond-square_algorithm][diamond-square algorithm]] that is meant to
54     produce random heightmap/plasma effect.
55
56   + During image compression: 2D image surface is iterated in the
57     similar manner to diamond-square algorithm. Average color from
58     neighbors is calculated and difference between neighbors average
59     and actual pixel color is saved. As the pixel grid becomes
60     gradually more dense, difference between neighbors tends to get
61     smaller, thereby requiring less bits per pixel for storing the
62     difference.
63 ** Algorighm advantages
64    :PROPERTIES:
65    :ID:       1d917f74-e763-4a71-976e-4aa60732efa6
66    :END:
67 + It can be applied to any amount of dimensions, even for sound and
68   volumetric data.
69
70 + Algorithm can operate in lossy and lossless mode.
71
72 + Algorithm naturally handles progressive loading. That is: low
73   resolution thumbnail of entire thing is immediately available and
74   gets gradually more dense during entire loading process.
75
76 + Algorithm naturally supports variable resolution. That is: different
77   areas can be encoded with different resolutions / pixel densities.
78
79 + Fast: Very little computations per pixel.
80
81 * TODO Things to improve
82 - Code documentation is weak.
83
84 - Better sample applications needed:
85   - Commandline image conversion utility.
86   - Image viewer.
87
88 - Add lossless support.
89
90 - Extract algorithm key parts into reusable library and make it
91   variable dimensional. So that the same code can be used for sound,
92   image and volumetric data compression/decompression.