Width of a String/Line in an Image
"sum up the image to get the area, then skeletonize the image and sum
  up that image to get the total length.Then divide the area by the
  length."


Input images is a binary image, thus either the pixel value will be zero(black pixel) or 255(while pixel).



Summing up the image gives the sum of all while pixels(black pixel are zero).

i.e., the area of whole white line

$Area = Sum/255$

After skeletonizing the image, the thick white lines become almost one pixel thick.



Summing it up will give the approximate length of the line.

Now, as we know the area occupied by the white line and length of the line.

Dividing them will result the thickness of the line.