This question already has an answer here:
If I have a [digital] photograph of an object, can I estimate it's approximate size?
I notice with interest that my camera (Nikon D3300) seems to record the approximate focal length of the lens in the Exif data. (It seems to round it to the nearest "common" nominal length.) However, I see nothing in the Exif data about the plane of focus. Presumably the camera system has that data somewhere (e.g., some lenses have it printed on the focusing scale), but I don't see it recorded anywhere.
Assuming I had the lens focal length and the lens focus distance, presumably it should be quite straight forward to estimate object size.
(In case it matters, I'm particularly interested in extremely tiny objects such as ants, grains of sand... stuff you can't exactly take a ruler to. I don't know whether that makes size estimates easier or harder.)