Here is a unix solution that follows Anthony's idea of averaging down to one row and one column and trimming the row and column with a fuzz factor. Then obtain the width and xoffset and the height an yoffset from the virtual canvas (page) geometry. The use those values to crop the image. However, the fuzz factors are going to be image dependent most likely, depending upon the (sort of) black borders and how black they really are and how uniform they really are.
Also as there seems to be bug in trimming 1 column images, I have had to rotate the image 90 degree.
Using your image from your first post at the top:
infile="931877.jpeg"
inname=`convert $infile -format "%t" info:`
convert $infile +repage -scale x1! -bordercolor black -border 1 -fuzz 30% -trim ${inname}_tmp1.png
width=`convert ${inname}_tmp1.png -format "%w" info:`
offsets=`convert ${inname}_tmp1.png -format "%O" info:`
xoff=`echo $offsets | cut -d+ -f2`
convert $infile +repage -rotate -90 -scale x1! -bordercolor black -border 1 -fuzz 60% -trim ${inname}_tmp2.png
height=`convert ${inname}_tmp2.png -format "%w" info:`
offsets=`convert ${inname}_tmp2.png -format "%O" info:`
yoff=`echo $offsets | cut -d+ -f2`
convert $infile -crop ${width}x${height}+${xoff}+${yoff} +repage ${inname}_crop.jpg
If on windows, I cannot help except to point you to
http://www.imagemagick.org/Usage/windows/ as there are syntax differences in IM and I don't know Batch file scripting equivalents to the unix above.
EdIt: It seems that there is no bug. My display was not showing a long vertical 1 column image. So the above could be changed to the following to avoid the image rotation:
infile="931877.jpeg"
inname=`convert $infile -format "%t" info:`
convert $infile +repage -scale x1! -bordercolor black -border 1 -fuzz 30% -trim ${inname}_tmp1.png
width=`convert ${inname}_tmp1.png -format "%w" info:`
offsets=`convert ${inname}_tmp1.png -format "%O" info:`
xoff=`echo $offsets | cut -d+ -f2`
convert $infile +repage -scale 1x! -bordercolor black -border 1 -fuzz 60% -trim ${inname}_tmp2.png
height=`convert ${inname}_tmp2.png -format "%h" info:`
offsets=`convert ${inname}_tmp2.png -format "%O" info:`
yoff=`echo $offsets | cut -d+ -f3`
convert $infile -crop ${width}x${height}+${xoff}+${yoff} +repage ${inname}_crop.jpg
You will need to remove the two tmp files afterwards.
EDIT2: I would suggest you test a few images and set the fuzz value in both parts to as high a value as it can stand without cropping into the text part of your image. (In the above, I used the minimum fuzz values that would just make it work.)