get("#388") -- rect functions get("#348") -- rgb functions get("#356") -- num2hex get("#380") -- imageHash get("#428") -- findContents problem = findContents() if problem then return problem end fw, fh = 8, 17 -- font width/height tw = math.floor((contents_x2-contents_x1)/fw+0.5) th = math.floor((contents_y2-contents_y1)/fh+0.5) print("Terminal size: "..tw.."*"..th) hash2char = {["00000000"]=string.char(32), ["00129d2e"]=string.char(33), ["0009009f"]=string.char(34), ["00080627"]=string.char(35), ["000bfef1"]=string.char(36), ["000c763c"]=string.char(37), ["001d7f40"]=string.char(38), ["0005a7c7"]=string.char(39), ["00174624"]=string.char(40), ["00077c4b"]=string.char(41), ["000f5fc0"]=string.char(42), ["0009fe7f"]=string.char(43), ["000f73ce"]=string.char(44), ["00081b8e"]=string.char(45), ["00074655"]=string.char(46), ["000e5593"]=string.char(47), ["001eb413"]=string.char(48), ["001dc4ca"]=string.char(49), ["001e4278"]=string.char(50), ["001f2586"]=string.char(51), ["000f86f7"]=string.char(52), ["0015dd33"]=string.char(53), ["0011920a"]=string.char(54), ["00170743"]=string.char(55), ["0014877f"]=string.char(56), ["000d5cf0"]=string.char(57), ["000931e0"]=string.char(58), ["000104ca"]=string.char(59), ["0001632a"]=string.char(60), ["0011bbfa"]=string.char(61), ["00193dbc"]=string.char(62), ["001c5c6c"]=string.char(63), ["0002bd64"]=string.char(64), ["000c9ca2"]=string.char(65), ["000d54c5"]=string.char(66), ["000862bb"]=string.char(67), ["0014cb96"]=string.char(68), ["00067780"]=string.char(69), ["001d2620"]=string.char(70), ["0012ed7d"]=string.char(71), ["000c1dd8"]=string.char(72), ["001caeb7"]=string.char(73), ["0007e4f6"]=string.char(74), ["001313f8"]=string.char(75), ["0010c310"]=string.char(76), ["001d8237"]=string.char(77), ["00016e4a"]=string.char(78), ["001f9576"]=string.char(79), ["0011d48e"]=string.char(80), ["000e8ede"]=string.char(81), ["0002cbac"]=string.char(82), ["001e373d"]=string.char(83), ["0018aa34"]=string.char(84), ["0009e28e"]=string.char(85), ["00099c19"]=string.char(86), ["00004f52"]=string.char(87), ["001e25b4"]=string.char(88), ["001a65fd"]=string.char(89), ["00096bc5"]=string.char(90), ["0004b27a"]=string.char(91), ["00055846"]=string.char(92), ["000775b1"]=string.char(93), ["00009e66"]=string.char(94), ["00106e2a"]=string.char(95), ["0002cd3f"]=string.char(96), ["0011c4ec"]=string.char(97), ["001805e2"]=string.char(98), ["0004fddc"]=string.char(99), ["001eecbf"]=string.char(100), ["000e132a"]=string.char(101), ["0011191b"]=string.char(102), ["00150164"]=string.char(103), ["001cc546"]=string.char(104), ["0002e222"]=string.char(105), ["001aa072"]=string.char(106), ["0004a441"]=string.char(107), ["000bd052"]=string.char(108), ["0005f5a5"]=string.char(109), ["001d558a"]=string.char(110), ["000b56ad"]=string.char(111), ["001fda7e"]=string.char(112), ["000d2ccd"]=string.char(113), ["000028bc"]=string.char(114), ["001e4ea4"]=string.char(115), ["00186a9d"]=string.char(116), ["0003565d"]=string.char(117), ["00072384"]=string.char(118), ["0011ff65"]=string.char(119), ["0012fe79"]=string.char(120), ["000bbcb1"]=string.char(121), ["00142583"]=string.char(122), ["0001b11c"]=string.char(123), ["0000e302"]=string.char(124), ["000ca029"]=string.char(125), ["0003c1d4"]=string.char(126)} tbl = {} for y = 0, th-1 do line = {} for x = 0, tw-1 do xx, yy = contents_x1+x*fw+1, contents_y1+y*fh cropped = {width=fw-1, height=fh, getInt = function(x, y) return img.getInt(xx+x, yy+y) end} hash = hashImage(cropped) c = hash2char[hash] print(xx, yy, hash, c) table.insert(line, c or "?") end table.insert(tbl, table.concat(line)) end return table.concat(tbl, "\n")