I need to get calculate some formulas based on Circle of Confusion and/or image dimensions (diagonal) in millimeters based on EXIF data only.

IOW, I cannot say "this photo was shot with Canon 5D3 hence is a FF sensor".

I think that's something related with focal plane resolution tags but I don't know how exactly the tags are named and how to calculate the diagonal. (I'm plan to use d/1500 or Zeiss formula to calculate CoC).

Any help?

  • \$\begingroup\$ Can you explain why you have this odd requirement? \$\endgroup\$
    – mattdm
    Jul 13, 2013 at 13:22
  • \$\begingroup\$ @mattdm: Searches through an SQL query over a DB with cached metadata. Of course, CoC isn't very interesting per se, but other calculated parameters which are based on it, are. \$\endgroup\$ Jul 13, 2013 at 13:58
  • \$\begingroup\$ Do you want to calculate the CoC for a particular display size/viewing distance, or do you want to know what the size of each pixel is? With CoC, whether anything is horizontal, vertical, or diagonal should make no difference. The key factors determining CoC are the magnification needed to produce an image at a desired viewing size from a given sensor size, the viewing distance desired, and the visual acuity of the viewer. \$\endgroup\$
    – Michael C
    Jul 13, 2013 at 15:23

2 Answers 2


Using the EXIF data, you should be able to use the following formula:
(Resolution in pixels/Focal plane resolution in dpi) X 25.4(mm/in)=size in mm

For my Canon 5DII, the horizintal and vertical numbers figure out to:
(5616p/3849.21ppi) X 25.4mm/in = 37.058mm
(3744p/3908.14ppi) X 25.4mm/in = 24.33mm

Once you have the horizontal and vertical measurements, you can calculate the diagonal measurement using the simple formula a² + b² = c² or c = √(a² + b²)

For the Canon 5DII, this figures out to: √(37.058² + 24.33²) = 44.33mm

As you can see, the result is slightly larger than the expected 36X24mm that would produce a 43.267mm diagonal. Canon publishes the sensor size as 36X24mm in sales literature, but specifies 35.8X23.9mm in technical literature for the 5DII. I got similar results for every camera I tried this with. Since the resolution reported is that of the image after demosaicing, the discrepancy can't be explained because of the extra edge pixels that are only used to interpolate the RGB values of the "effective" pixels used in the demosaiced image.

Rather than use the EXIF data, you could also consult a database such as can be found at DxO Mark. The sensor dimensions, in mm, of every camera they test is included in the specifications tab for each camera.

In general, FF cameras use sensors that are 36X24mm, APS-C cameras (other than Canon) use sensors that are 23.5X15.6mm, Canon APS-C sensors are 22.3X14.9mm. For a full list of sensor sizes used by almost every current manufacturer, see the chart near the end of http://en.wikipedia.org/wiki/Image_sensor_format

  • \$\begingroup\$ +1 to database approach. I suggest using that and then falling back to the calculation if you don't get a match. \$\endgroup\$
    – mattdm
    Jul 13, 2013 at 14:32

I'm out of my element here, but...

I did some testing and it seems that if you take the horizontal/vertical resolution of the camera's sensor, divide that by the Focal Plane Horizontal/Vertical Resolution EXIF value, then convert the result to millimeters, you get a very close estimate to the dimensions of the sensor size.

Example, using my T4i:

Sensor horizontal resolution: 5184 px
Sensor vertical resolution: 3456 px

Focal Plane Horiz Resolution: 5798 dpi 
Focal Plane Vert Resolution: 5788 dpi

5184 px / 5798 dpi = 0.89410141428079 in
3456 px / 5788 dpi = 0.59709744298549 in

0.89410141428079 inches in mm = 22.7102 mm
0.59709744298549 inches in mm = 15.1663 mm

The T4i sensor is apparently 22.3x14.9mm, so you can get quite close with this fairly simple method.

BTW, this seems to be a great page for deciphering EXIF data.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.