Visually inspect a router bit image, determine the bounding box of the bit, crop to that region, and resize for the inventory page.
Crop a router bit product image to just the bit itself, removing marketing text, captions, accessories, and excess whitespace.
Read the image at the path provided in $ARGUMENTS using the Read tool to visually inspect it.
Isolate objects using isolate-objects.py. This uses connected component analysis to find distinct objects on the white background and saves each as a separate image:
./workshop/router-bits/isolate-objects.py <image-path>
Output is one line per object (largest first):
<index> <outfile> <top>,<left>,<width>,<height> <pixel-area>
Use --max-y N to exclude caption text (default: 85% of image height).
Use to adjust white detection (default: 252).
--threshold NVisually inspect each object using the Read tool. Identify which are router bits vs accessories (hex keys, collars, bearings, packaging). If there are multiple bits, each one will need to be processed.
For each router bit object, copy its isolated image file to the target path and resize with trim-image.sh:
cp <object-file> <image-path>
./workshop/router-bits/trim-image.sh <image-path>
Read the final image to verify — the bit should be centered, isolated on white, with no other objects or text visible.
If isolation isn't clean (objects too close together, non-white background), adjust --threshold or --padding and re-run.