!752

static int grabWidth = 500, grabHeight = 300;

p {
  while licensed {
    pcall {
      Point from = mouseLocation();
      //print("yo " + from + " " + to);
      Rect r = intersectWithScreen(rectAround(new Pt(from), grabWidth, grabHeight));
      BWImage img = shootScreenBW(r);
      L<Rect> rects = autoSegment(img, 3);
      print("Grabbing " + r + ", got " + n(l(rects), "rect"));
      Rect found = firstRectContaining(rects, from.x-r.x, from.y-r.y);
      if (found != null) {
        BWImage result = img.clip(found.getRectangle());
        quickShowZoomedImage(result.getBufferedImage());
      } else
        print("Nope");
    }
    sleepSeconds(1);
  }
}