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