crop = otherresults["#324"] if crop == nil then error("need output of #324, please recalc") end local _, _, x1, y1, x2, y2 = string.find(crop, "(%d+),%s*(%d+),%s*(%d+),%s*(%d+)") if x1 == nil then error("output of #324 malformed") end print("x1", x1, "y1", y1, "x2", x2, "y2", y2) -- crop the image local orig = img img = { width = x2-x1, height = y2-y1, getInt = function(x, y) return orig.getInt(x+x1, y+y1) end }