What you are basically doing is trying to seperate the object from the background, then find its location.
The -trim is a very raw, low level technique. With a border of white, you are essentually doing a raw threshold at a fixed greylevel. That is some thing equivelent to...
convert input.png -threshold 35% mask.png
The mask is just a black and white pattern that should define what is foreground and background. The trim then just finds its bounds.
Separating a foreground object from the background can be hard, especially with the large gradients you are seeing, though as you are not after the exact shape, this task is not as hard as full background removal.
I remember Fred created a LOT of different scripts to try and do this type of separation in very horrible conditions.
See Fred's ImageMgaick Scripts
http://www.fmwconcepts.com/imagemagick/
and go down the page to 'Threshold Segment' scripts. Most of these are 'histogram separation' techniques,
but it should let you remove (well automate) the 'fuzz' factor in a number of different ways.
Especially see the 'comparison page'.
http://www.fmwconcepts.com/imagemagick/ ... /index.php
Doing a small amount of morphology could also help smooth out the mask before finding its bounds.