i, j, px, py = string.find(result, "([0-9.]+),%s*([0-9.]+)") px, py = math.floor(px+0.5), math.floor(py+0.5) -- copy image w, h = img.width, img.height pixels = {} for y = 0, h-1 do for x = 0, w-1 do pixels[y*w+x+1] = img.getInt(x, y) end end -- paint point for y = math.max(py-1, 0), math.min(py+1, h-1) do for x = math.max(px-1, 0), math.min(px+1, w-1) do pixels[y*w+x+1] = 0xFF0000 end end