get("#369") -- Magic Wand, optimized get("#349") -- table functions get("#380") -- hashImage wandSize = 3 allrects = magicWandAll(img) function stringtorect(s) local _, _, x1, y1, x2, y2 = string.find(s, "(%d+),%s*(%d+),%s*(%d+),%s*(%d+)") x1, y1, x2, y2 = tonumber(x1), tonumber(y1), tonumber(x2), tonumber(y2) return newRectangle(x1, y1, x2-x1, y2-y1) end result = {} for s, _ in pairs(allrects) do r = stringtorect(s) cropped = {width=r.width, height=r.height, getInt = function(x, y) return img.getInt(x+r.x, y+r.y) end} hash = hashImage(cropped) table.insert(result, s.." -> "..hash) end result = table.concat(result, "|") if result ~= '' then return "Magic Wand + hashes (wand size="..wandSize.."): "..result end