Setting canvas.width/height clears its bitmap; the live RGB tick was firing the img.load handler every second, wiping the ROI rectangle and breaking the two-click flow (third click was interpreted as restart). - Only mutate canvas size when image resolution actually changes. - Re-paint the overlay after each load so the ROI persists. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>