My two results above for sofa_cat_small.jpg use sigma=1 for the comet, and sigma=20 for the main blur. The thresholds are 99,97,95,90,85,80. The first set of six images trim to all the components. The second set trim to just the largest component.
There is another difference between my script and Fred's. Trimming to one or all components gives crop parameters WxH+X+Y. We can either use these parameters directly to crop the input image, or we can ignore +X+Y and then use the "white rectangle" method to find the best offsets for WxH (which I implement as a recursive call to the script).
The recursive method gives a different result (and is slower). It is currently my default, because it always seems better.
After another day of hacking, I've got a scheme that gives good results on all these input images, whether the user supplies both dimensions, only one, or none. Moreover, we get good results for a wide range of thresholds. More work is required, including testing with large images.
The details are too complex for this post. See
Crop to detail.