1 | get("#348") -- rgb functions |
2 | |
3 | function stringRepImage(img) |
4 | local x, y, w, h = 0, 0, img.width, img.height -- full image |
5 | |
6 | local tbl = {} |
7 | for yy=y, y+h-1 do |
8 | if yy > y then table.insert(tbl, ".") end |
9 | for xx=x, x+w-1 do |
10 | local pix = img.getInt(xx, yy) |
11 | local b = math.floor(bright(rgb(pix))*25+0.5) |
12 | table.insert(tbl, string.char(string.byte("A")+b)) |
13 | end |
14 | end |
15 | return table.concat(tbl) |
16 | end |
Began life as a copy of #382
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
Snippet ID: | #417 |
Snippet name: | stringRepImage (include) |
Eternal ID of this version: | #417/1 |
Text MD5: | a715f76dce5a4caa8d4aa4a9b269d0e6 |
Author: | stefan |
Category: | |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-02-06 14:03:45 |
Source code size: | 435 bytes / 16 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 724 / 211 |
Referenced in: | [show references] |