Demonstrating huffman compression over uncompressed and jpg compression image.
pip install -r requirements.txt
python huffman.py lena
completed huffman encode compression in 3.5245704650878906 seconds.
completed huffman compression decode in 4.457077503204346 seconds.
==== files sizes ====
raw image size (TIFF) : 786572 bytes.
compressed image size (JPG) : 35729 bytes.
compressed image size (HUFF) : 766500 bytes.
huffman compression ratio vs raw: 2.5518325086578244 %
huffman compression ratio vs jpg compression: -2045.3161297545412 %
==== Huffman Map ====
0 1111111011000101
1 1111111011000100
2 111111101100011
3 11111110110000
4 1100011001100
5 1111111011001
6 010011011110
7 110001100111
8 111111101101
9 10110110000
10 11011001000
11 11111110111
12 1001101000
13 1100011000
14 1110000111
15 1111011111
16 100001010
17 101011010
18 110001000
19 110011101
20 110110011
21 111010011
22 111001100
23 111010001
24 111001101
25 111001111
26 111001011
27 110100101
28 110100100
29 110001001
30 101101101
31 101000100
32 011000111
33 011000110
34 1111011110
35 1111011100
36 1110101001
37 1110100000
38 1110010100
39 1110010101
40 1110011100
41 1110011101
42 1110000110
43 1110101000
44 1110110100
45 1110100001
46 1111011101
47 1111111010
48 000111001
49 010011010
50 100001011
51 101000101
52 101011011
53 110011100
54 111000010
55 111100000
56 00011011
57 01010010
58 10100100
59 10110111
60 11010011
61 11011110
62 11101100
63 11110010
64 0000101
65 0010000
66 0000111
67 0000011
68 0000001
69 11111101
70 11110101
71 11110011
72 11101111
73 11111000
74 11110110
75 11111011
76 0001111
77 0011100
78 0010011
79 0011111
80 0011010
81 0010101
82 0011011
83 0100010
84 0100111
85 0101101
86 0110101
87 1000101
88 1000111
89 1010011
90 1010101
91 1011001
92 1011101
93 1011111
94 1100001
95 1100100
96 1100101
97 1100000
98 1011010
99 1010111
100 1001110
101 1001011
102 1000011
103 0111010
104 0101010
105 0011001
106 0100001
107 0100100
108 0101100
109 0011110
110 0100101
111 0010100
112 0001100
113 0010110
114 0001011
115 0000000
116 11111100
117 11111010
118 11111111
119 0010010
120 0011101
121 0111011
122 0111111
123 0111000
124 0110011
125 0101111
126 0011000
127 0001001
128 0000110
129 11111001
130 11101110
131 11101011
132 11011111
133 11011000
134 11010111
135 11010101
136 11000111
137 11001111
138 10111101
139 10110000
140 10100011
141 10010001
142 10010010
143 10000000
144 01101101
145 01010110
146 01100001
147 00100010
148 01011101
149 01010001
150 01011100
151 01000001
152 01001100
153 01000111
154 01100000
155 01010000
156 01101001
157 01100010
158 01100100
159 01010011
160 01000000
161 00010101
162 00010100
163 00001000
164 00010001
165 00000101
166 00001001
167 00000100
168 111111100
169 00100011
170 00011101
171 01000110
172 01101111
173 01101100
174 10010011
175 10011111
176 10100001
177 10100000
178 10010101
179 01111010
180 10010000
181 10000010
182 01100101
183 01111001
184 10001001
185 10000011
186 01110011
187 01101110
188 10011001
189 10001101
190 10011011
191 10011000
192 10000001
193 10010100
194 10001000
195 01111000
196 01111011
197 01111101
198 10000100
199 10011110
200 10101100
201 10110001
202 11001100
203 11010001
204 11011011
205 11011010
206 11100010
207 11100100
208 11100011
209 11010100
210 11001101
211 10111000
212 10101001
213 10001100
214 01101000
215 00101111
216 01010111
217 01110010
218 10100101
219 10111001
220 11000101
221 11010110
222 11100000
223 11011100
224 11011101
225 11010000
226 10111100
227 10101000
228 01111100
229 00010000
230 111100010
231 111100011
232 111100001
233 111010101
234 111011011
235 111101000
236 00101110
237 00011010
238 111101001
239 111010010
240 110001101
241 100110101
242 000111000
243 1101100101
244 1011011001
245 1001101001
246 0100110110
247 11101101010
248 11000110010
249 10110110001
250 01001101110
251 110110010011
252 110110010010
253 010011011111
254 1100011001101
255 11101101011