Hmm a very high aspect ratio image. 4:1
That may require a custom distance metric with ratio that is rotated 90 degrees (top and bottom is more costly)
Code: Select all
convert output.png -virtual-pixel black -morphology Distance '3: 5,4,5 1,0,1 5,4,5' -auto-level results.png
The brightest point is the center of the largest 4:1 ratio rectangular area found.
and shows it to be the top corners or somewhere along the bottom edge.
However there is a point on the right side 3/4 of the way done the page (afetr the paragraph starting "Brasilia -DF ..."). It isn't as large though it would be if you didn't want a 'edge' result.
if the page was 'trimmed' so the addition was limited to within the text bounds, somewhere around that location actually does become the 'best' location.
To extract the maximum point(s) and use the 'normalized' image as a mask as a mask to get position and size from the distance result.
Code: Select all
convert output.png -virtual-pixel black -morphology Distance '3: 5,4,5 1,0,1 5,4,5' \
\( +clone -auto-level -fill black +opaque white \) \
-compose multiply -composite -depth 16 txt: |\
grep -v black
394,53: ( 216, 216, 216) #00D800D800D8 rgb(0.329595%,0.329595%,0.329595%)
395,53: ( 216, 216, 216) #00D800D800D8 rgb(0.329595%,0.329595%,0.329595%)
396,53: ( 216, 216, 216) #00D800D800D8 rgb(0.329595%,0.329595%,0.329595%)
That is a box 216x2+1 by 216x2/4+1 pixels => 433 x 109 pixels in size centered on any of those 3 pixels
(bottom of page).