1 | get("#178") -- PET font
|
2 | get("#179") -- base64
|
3 | |
4 | l = math.ceil(#pixels/8) |
5 | t = {}
|
6 | for i=1, l do |
7 | local b, x = 0, 128 |
8 | for j=0, 7 do |
9 | local p = pixels[i*8-7+j] |
10 | if p ~= nil and p ~= 0 then |
11 | b = b+x |
12 | end |
13 | x = x/2 |
14 | end |
15 | if i <= 8 then print(b) end |
16 | table.insert(t, string.char(b)) |
17 | end |
18 | s = table.concat(t) |
19 | print("string length: "..tostring(#s))
|
20 | compressed = encode64(s) |
21 | print("base64 length: "..tostring(#compressed))
|
22 | |
23 | code = "grab('#181') -- uncompressor\n"
|
24 | code = code.."width, height = "..tostring(width)..", "..tostring(height).."\n" |
25 | code = code.."pixels = uncompress('"..compressed.."')"
|
26 | print(code) |
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Recognizer | Recognition Result | Visualize | Recalc |
|---|---|---|---|
| #308 | 644 | [visualize] |
| Snippet ID: | #180 |
| Snippet name: | b/w image compressor |
| Eternal ID of this version: | #180/1 |
| Text MD5: | 9fe4d2ff057c8c2da954af123dae58db |
| Author: | stefan |
| Category: | |
| Type: | Lua code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2014-01-16 04:25:27 |
| Source code size: | 644 bytes / 26 lines |
| Pitched / IR pitched: | Yes / Yes |
| Views / Downloads: | 1197 / 301 |
| Referenced in: | [show references] |