Fredrik Lundh is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

effbot / pil-2009-raclette http://effbot.org/zone/pil-index.htm

Work repository for PIL 1.1.7 and beyond. The "default" branch should be fairly solid, the other branches less so. For production use, see the pil-117 repository.

Clone this repository (size: 1.6 MB): HTTPS / SSH
hg clone https://bitbucket.org/effbot/pil-2009-raclette
hg clone ssh://hg@bitbucket.org/effbot/pil-2009-raclette

pil-2009-raclette / PIL / ExifTags.py

commit
454b4d2672f3
parent
64f9636f4d92
branch
default
tags
pil-117-20090317, pil-117a1-20090317

Don't try to open files twice if plugins are already loaded.

1
770a9717f387
#
2
770a9717f387
# The Python Imaging Library.
3
770a9717f387
# $Id: ExifTags.py 2631 2006-02-12 23:41:52Z fredrik $
4
770a9717f387
#
5
770a9717f387
# EXIF tags
6
770a9717f387
#
7
770a9717f387
# Copyright (c) 2003 by Secret Labs AB
8
770a9717f387
#
9
770a9717f387
# See the README file for information on usage and redistribution.
10
770a9717f387
#
11
770a9717f387
12
770a9717f387
##
13
770a9717f387
# This module provides constants and clear-text names for various
14
770a9717f387
# well-known EXIF tags.
15
770a9717f387
##
16
770a9717f387
17
770a9717f387
##
18
770a9717f387
# Maps EXIF tags to tag names.
19
770a9717f387
20
770a9717f387
TAGS = {
21
770a9717f387
22
770a9717f387
    # possibly incomplete
23
770a9717f387
    0x0100: "ImageWidth",
24
770a9717f387
    0x0101: "ImageLength",
25
770a9717f387
    0x0102: "BitsPerSample",
26
770a9717f387
    0x0103: "Compression",
27
770a9717f387
    0x0106: "PhotometricInterpretation",
28
770a9717f387
    0x010e: "ImageDescription",
29
770a9717f387
    0x010f: "Make",
30
770a9717f387
    0x0110: "Model",
31
770a9717f387
    0x0111: "StripOffsets",
32
770a9717f387
    0x0112: "Orientation",
33
770a9717f387
    0x0115: "SamplesPerPixel",
34
770a9717f387
    0x0116: "RowsPerStrip",
35
770a9717f387
    0x0117: "StripByteConunts",
36
770a9717f387
    0x011a: "XResolution",
37
770a9717f387
    0x011a: "XResolution",
38
770a9717f387
    0x011b: "YResolution",
39
770a9717f387
    0x011b: "YResolution",
40
770a9717f387
    0x011c: "PlanarConfiguration",
41
770a9717f387
    0x0128: "ResolutionUnit",
42
770a9717f387
    0x0128: "ResolutionUnit",
43
770a9717f387
    0x012d: "TransferFunction",
44
770a9717f387
    0x0131: "Software",
45
770a9717f387
    0x0132: "DateTime",
46
770a9717f387
    0x013b: "Artist",
47
770a9717f387
    0x013e: "WhitePoint",
48
770a9717f387
    0x013f: "PrimaryChromaticities",
49
770a9717f387
    0x0201: "JpegIFOffset",
50
770a9717f387
    0x0202: "JpegIFByteCount",
51
770a9717f387
    0x0211: "YCbCrCoefficients",
52
770a9717f387
    0x0211: "YCbCrCoefficients",
53
770a9717f387
    0x0212: "YCbCrSubSampling",
54
770a9717f387
    0x0213: "YCbCrPositioning",
55
770a9717f387
    0x0213: "YCbCrPositioning",
56
770a9717f387
    0x0214: "ReferenceBlackWhite",
57
770a9717f387
    0x0214: "ReferenceBlackWhite",
58
770a9717f387
    0x1000: "RelatedImageFileFormat",
59
770a9717f387
    0x1001: "RelatedImageLength",
60
770a9717f387
    0x1001: "RelatedImageWidth",
61
770a9717f387
    0x828d: "CFARepeatPatternDim",
62
770a9717f387
    0x828e: "CFAPattern",
63
770a9717f387
    0x828f: "BatteryLevel",
64
770a9717f387
    0x8298: "Copyright",
65
770a9717f387
    0x829a: "ExposureTime",
66
770a9717f387
    0x829d: "FNumber",
67
770a9717f387
    0x8769: "ExifOffset",
68
770a9717f387
    0x8773: "InterColorProfile",
69
770a9717f387
    0x8822: "ExposureProgram",
70
770a9717f387
    0x8824: "SpectralSensitivity",
71
770a9717f387
    0x8825: "GPSInfo",
72
770a9717f387
    0x8827: "ISOSpeedRatings",
73
770a9717f387
    0x8828: "OECF",
74
770a9717f387
    0x8829: "Interlace",
75
770a9717f387
    0x882a: "TimeZoneOffset",
76
770a9717f387
    0x882b: "SelfTimerMode",
77
770a9717f387
    0x9000: "ExifVersion",
78
770a9717f387
    0x9003: "DateTimeOriginal",
79
770a9717f387
    0x9004: "DateTimeDigitized",
80
770a9717f387
    0x9101: "ComponentsConfiguration",
81
770a9717f387
    0x9102: "CompressedBitsPerPixel",
82
770a9717f387
    0x9201: "ShutterSpeedValue",
83
770a9717f387
    0x9202: "ApertureValue",
84
770a9717f387
    0x9203: "BrightnessValue",
85
770a9717f387
    0x9204: "ExposureBiasValue",
86
770a9717f387
    0x9205: "MaxApertureValue",
87
770a9717f387
    0x9206: "SubjectDistance",
88
770a9717f387
    0x9207: "MeteringMode",
89
770a9717f387
    0x9208: "LightSource",
90
770a9717f387
    0x9209: "Flash",
91
770a9717f387
    0x920a: "FocalLength",
92
770a9717f387
    0x920b: "FlashEnergy",
93
770a9717f387
    0x920c: "SpatialFrequencyResponse",
94
770a9717f387
    0x920d: "Noise",
95
770a9717f387
    0x9211: "ImageNumber",
96
770a9717f387
    0x9212: "SecurityClassification",
97
770a9717f387
    0x9213: "ImageHistory",
98
770a9717f387
    0x9214: "SubjectLocation",
99
770a9717f387
    0x9215: "ExposureIndex",
100
770a9717f387
    0x9216: "TIFF/EPStandardID",
101
770a9717f387
    0x927c: "MakerNote",
102
770a9717f387
    0x9286: "UserComment",
103
770a9717f387
    0x9290: "SubsecTime",
104
770a9717f387
    0x9291: "SubsecTimeOriginal",
105
770a9717f387
    0x9292: "SubsecTimeDigitized",
106
770a9717f387
    0xa000: "FlashPixVersion",
107
770a9717f387
    0xa001: "ColorSpace",
108
770a9717f387
    0xa002: "ExifImageWidth",
109
770a9717f387
    0xa003: "ExifImageHeight",
110
770a9717f387
    0xa004: "RelatedSoundFile",
111
770a9717f387
    0xa005: "ExifInteroperabilityOffset",
112
770a9717f387
    0xa20b: "FlashEnergy",
113
770a9717f387
    0xa20c: "SpatialFrequencyResponse",
114
770a9717f387
    0xa20e: "FocalPlaneXResolution",
115
770a9717f387
    0xa20f: "FocalPlaneYResolution",
116
770a9717f387
    0xa210: "FocalPlaneResolutionUnit",
117
770a9717f387
    0xa214: "SubjectLocation",
118
770a9717f387
    0xa215: "ExposureIndex",
119
770a9717f387
    0xa217: "SensingMethod",
120
770a9717f387
    0xa300: "FileSource",
121
770a9717f387
    0xa301: "SceneType",
122
770a9717f387
    0xa302: "CFAPattern",
123
770a9717f387
124
770a9717f387
}
125
770a9717f387
126
770a9717f387
##
127
770a9717f387
# Maps EXIF GSP tags to tag names.
128
770a9717f387
129
770a9717f387
GPSTAGS = {
130
770a9717f387
    0: "GPSVersionID",
131
770a9717f387
    1: "GPSLatitudeRef",
132
770a9717f387
    2: "GPSLatitude",
133
770a9717f387
    3: "GPSLongitudeRef",
134
770a9717f387
    4: "GPSLongitude",
135
770a9717f387
    5: "GPSAltitudeRef",
136
770a9717f387
    6: "GPSAltitude",
137
770a9717f387
    7: "GPSTimeStamp",
138
770a9717f387
    8: "GPSSatellites",
139
770a9717f387
    9: "GPSStatus",
140
770a9717f387
    10: "GPSMeasureMode",
141
770a9717f387
    11: "GPSDOP",
142
770a9717f387
    12: "GPSSpeedRef",
143
770a9717f387
    13: "GPSSpeed",
144
770a9717f387
    14: "GPSTrackRef",
145
770a9717f387
    15: "GPSTrack",
146
770a9717f387
    16: "GPSImgDirectionRef",
147
770a9717f387
    17: "GPSImgDirection",
148
770a9717f387
    18: "GPSMapDatum",
149
770a9717f387
    19: "GPSDestLatitudeRef",
150
770a9717f387
    20: "GPSDestLatitude",
151
770a9717f387
    21: "GPSDestLongitudeRef",
152
770a9717f387
    22: "GPSDestLongitude",
153
770a9717f387
    23: "GPSDestBearingRef",
154
770a9717f387
    24: "GPSDestBearing",
155
770a9717f387
    25: "GPSDestDistanceRef",
156
770a9717f387
    26: "GPSDestDistance"
157
770a9717f387
}