I have bunch of EXIF files. I am looking for some heuristics to extract qualitative information such as if the picture is portrait or not, if the picture was taken in day or night, if the picture is scenary or something like that. Would you please help on how to get these kind of info from the EXIF files?

  • \$\begingroup\$ Hi Alec. An important question, though: do you mean JPEG/EXIF files (which around here we normally call just "JPEG"), or do you mean files which contain just the EXIF metadata? And if you do also mean image data, do you want to do pattern recognition on the image data, or just analyze the metadata for clues? \$\endgroup\$
    – mattdm
    Commented Dec 8, 2011 at 20:48
  • \$\begingroup\$ @mattdm: I have only EXIF metadata and I am looking for heuristics to find clues such as the one I mentioned in the original question only by using EXIF meta data. \$\endgroup\$ Commented Dec 8, 2011 at 20:54
  • \$\begingroup\$ This is going to be very hard, for reasons similar to those outlined in my answer here. Depending on the specific camera, you may be able to tell if the camera was in some sort of special mode, but you won't be able to tell if the camera was in sports mode but used to take a picture of a tree. \$\endgroup\$
    – mattdm
    Commented Dec 8, 2011 at 21:19
  • \$\begingroup\$ @mattdm: How about picitures taken in day/or night? Is this possible?What information helps me to findout whether it is portriat or not? All in all, what sort of clues can be extracted only from EXIF meta date? \$\endgroup\$ Commented Dec 8, 2011 at 21:31
  • 2
    \$\begingroup\$ Though interesting, this question seems to have more in common with machine learning (a branch of artificial intelligence) than it does with photography. As such, I'm not sure this site will be able to provide the best answers. \$\endgroup\$
    – Sean
    Commented Dec 8, 2011 at 21:48

1 Answer 1


From the EXIF metadata you can calculate the “nominal” luminance of the scene, i.e. the luminance that the camera ought to render as midtones: use this exposure equation. This luminance should provide a good heuristic about whether it is a day or a night shot. But look also at the time the picture was taken: low luminance in day time probably means the picture was taken indoors.

You should have the information about the orientation of the camera, so you know whether the picture was taken in “portrait” or “landscape” mode, although this may not be well correlated with the actual contents of the picture... If it's recorded in the EXIF, a long focusing distance may be a better indicator that the picture is a landscape.

Look also at the focal length, chances are you don't take the same kind of pictures with a long or a short lens.

In any case, you will certainly have to find your own rules, since the possible correlations between EXIF data and picture contents will likely depend on your personal shooting style.


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.