I was photographing in the last couple of months - please tell me if you like them:

FreePics
Last week, I was trying to find out how to get my photo’s metadata. I had noticed that Windows could display the camera model, creation date and lots of other data on my photos, but I couldn’t remember what that data was called. I finally found what I was looking for. The term is EXIF (Exchangeable Image File Format). For this post, we’ll take a look at the various 3rd party packages that give you access to this information.
My first thought was that the Python Imaging Library would have this functionality, but I hadn’t found the EXIF term yet and couldn’t find that info in PIL’s handbook without it. Fortunately, I did eventually find a way to use PIL via a stackoverflow thread. Here’s the method that it showed:
from PIL import Image
from PIL.ExifTags import TAGS
def get_exif(fn):
ret = {}
i = Image.open(fn)
info = i._getexif()
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
ret[decoded] = value
return ret
This works quite well and returns a nice dictionary object. There are several fields that I found useless, such as the “MakerNote” field which looked like a lot of hexadecimal values, so you’ll probably only want to use certain pieces of data. Here’s a sample of some of the info I got back:
{'YResolution': (180, 1),
'ResolutionUnit': 2,
'Make': 'Canon',
'Flash': 16,
'DateTime': '2009:09:11 11:29:10',
'MeteringMode': 5,
'XResolution': (180, 1),
'ColorSpace': 1,
'ExifImageWidth': 3264,
'DateTimeDigitized': '2009:09:11 11:29:10',
'ApertureValue': (116, 32),
'FocalPlaneYResolution': (2448000, 169),
'CompressedBitsPerPixel': (3, 1),
'SensingMethod': 2,
'FNumber': (35, 10),
'DateTimeOriginal': '2009:09:11 11:29:10',
'FocalLength': (26000, 1000),
'FocalPlaneXResolution': (3264000, 225),
'ExifOffset': 196,
'ExifImageHeight': 2448,
'ISOSpeedRatings': 100,
'Model': 'Canon PowerShot S5 IS',
'Orientation': 1,
'ExposureTime': (1, 200),
'FileSource': '\x03',
'MaxApertureValue': (116, 32),
'ExifInteroperabilityOffset': 3346,
'FlashPixVersion': '0100',
'FocalPlaneResolutionUnit': 2,
'YCbCrPositioning': 1,
'ExifVersion': '0220'}
I don’t really know what all of those values mean, but I know I can use some of them. My purpose for wanting the data is to expand my simple Image Viewer such that it can display more info to the user about their photo.
Here are a few other libraries I found that can supposedly give access to the EXIF data:
- Media Metadata for Python
- EXIF.py
- Python Exif Parser
- A Blogger’s Exif Parser
- pyexiv2
I tried the Python Exif Parser and it worked quite well. When I tried to install pyexiv2 on my Python 2.5 box at work, I got an error message about Python 2.6 not being found and then the installer quit. There is no mention on the pyexiv2 website that it requires a certain version of Python to work, so that was a little frustrating. Most of these modules have little or no documentation, which was also pretty frustrating. From what I can tell, EXIF.py is supposed to be used via the command line rather than as an importable module.
Anyway, back to the Python Exif Parser. It’s actually simpler to use than PIL is. Here’s all you need to do after copying the exif.py file into your Python path:
import exif
photo_path = "somePath\to\a\photo.jpg"
data = exif.parse(photo_path)
The code above returns mostly the same information that the PIL snippet does, although it uses integers instead of hex for the “MakersNote” and it has several “Tag0xa406′” fields whereas the PIL data had some numerical fields (which I excluded above). I assume they reference the same information in different ways though.
Anyway, should you find yourself wandering the web when trying to discover this information, hopefully you will stumble upon this post and it will point you in the right direction.
Instruction for comments :
You can use these tags:
XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
If you haven't stopped by The Sartorialist in a little while, you need to now. Scott is currently hosting a vintage photo contest where readers can submit vintage photos of family or even strangers at their most stylish.
Of course, I'm loving all of the classic styles, but the thing that I've found especially interesting is how much more focus I place on the wearer than on the clothes themselves. All of the subjects of the photos have a certain poise or swagger about them that matters so much more than what they're wearing. So all of those times your mom told you confidence is what matters — she was right! Although a pair of killer heels or perfectly tailored pants sure doesn't hurt.
I wish I had access to my family archives to enter, but I urge all of you guys to do so if you can. Contest rules here.
9 Responses to “Nike Hoop Structure Low – Metallic Silver – Black – Photo Blue | HOH Summer 2010”
Login or Register to Leave a Comment
Make sure to Register if you comment regularly. Registration is easy, it only requires your email and a username.
Leave a Comment as Guest:
Name (required)
Email (will not be published) (required)
Write Your Comment Here:
from: Sandersons Site
Amaors Site
Adibas Site
March 29th, 2010 at 10:10 am
Mine!!
March 29th, 2010 at 10:27 am
purty..love the cw
March 29th, 2010 at 10:46 am
these lows are nice
March 29th, 2010 at 10:56 am
Oh yeah! Those go so hard!
March 29th, 2010 at 10:59 am
Nice design, but this one may be a lil too colourful for me.
March 29th, 2010 at 11:01 am
DeF. A goOD looK oNd’S
March 29th, 2010 at 11:06 am
Great colorway but not my type of sneaker . I’ll pass on this 1
March 29th, 2010 at 11:22 am
why so many colors? Who wants to look lile they’re hoopin with a pack of nownlaters* on they feet?
*Now & Laters®
March 29th, 2010 at 11:41 am
Love the Low and the carbon fiber toe box, hot shoe. HOH sucks though.