# How to calculate object size dependent on distance?

I shot some images for use in a blog post. With the closeups, I ran into the problem of too low depth of field. Because I only need them for the web, I think that the easiest way to solve it would be to take them from farther apart and then crop them instead of downscaling. Now I need some guideline about how far away I should stand.

Let's say that I took a picture at X cm distance between subject and sensor, and the subject fills the 4000 px wide picture. If I want the same object to be at least 640 px wide, what is the farthest distance I can have between subject and sensor?

• This doesn't directly answer your question, but I think the easiest way to solve the problem would be to select a narrower aperture, and gain a greater depth of field. You can use a tripod or a higher ISO if camera movement becomes a problem. May 23, 2012 at 16:21
• @dpollitt no, it was a very close shot, even the narrowest aperture wasn't enough. Also, my DX sensor hits diffraction limit at f/16, if I remember correctly. May 23, 2012 at 16:30
• Do you have just decent point and shoot also? May 23, 2012 at 18:03

Why work so hard? I think you are making this much harder than it has to be.

Getting something to be exactly 640 pixels in the image will be difficult, require careful measurements and accurate calculations and is very error prone (and for something really close the internal construction of the lens makes a huge difference and this will be impossible to calculate)

But Getting something in the ballpark with a nice safety margin and than downscaling the rest of the way is ridiculously easy.

just move back until the subject covers approximately 1/3 of the frame than crop and after that downscale the rest of the way.

Why 1/3? You want 640px out of 4000, that is approx 1/6, I want to make it a little bigger to be on the safe side and 1/3 is really easy to judge by eye compered to 1/5 or 1/4.

At that distance hopefully you already solved the DOF problem - and even if the image is still a little bit blurry downscaling will make it less blurry.

By the way, the fact that downscaling reduces blurriness also let you use a smaller aperture, the blur caused by diffraction will be reduced.

• I know I can estimate it, I wanted to know how the calculations are done. May 24, 2012 at 8:14
• @rumtscho - If I remember my geometry correctly, in theory, you take the distance and multiply if by 4000/640 -- but back here in the real world where focal length changes a bit with focus this will only give you a rough estimate, unless it's a macro shot (I believe you said it is) in macro mode lenses act strangely and you can't make this calculation at all without taking the lens internal construction into account
– Nir
May 24, 2012 at 10:57

Since what you're after is depth of field, I'd use one of the many depth of field calculators to compute how far away you need to be to get the depth of field you need/want, and shoot from there.

• No, I would rather accept a slightly small depth of field in this case than a motif I have to upscale (if the required distance for a given depth of field turns out to be too far for a 640 px motif). May 24, 2012 at 8:16