Skip to content

Commit dd1099b

Browse files
committed
TIFF tag names
Expand list of named tags, expose as 'tag_name' key for all entries
1 parent 1746194 commit dd1099b

File tree

1 file changed

+237
-8
lines changed

1 file changed

+237
-8
lines changed

getid3/module.graphic.tiff.php

Lines changed: 237 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public function Analyze() {
6262
$CurrentIFD['fields'][$i]['raw']['length'] = $this->TIFFendian2Int($this->fread(4), $info['tiff']['byte_order']);
6363
$CurrentIFD['fields'][$i]['raw']['offset'] = $this->fread(4);
6464

65+
$CurrentIFD['fields'][$i]['raw']['tag_name'] = $this->TIFFcommentName($CurrentIFD['fields'][$i]['raw']['tag']);
66+
6567
switch ($CurrentIFD['fields'][$i]['raw']['type']) {
6668
case 1: // BYTE An 8-bit unsigned integer.
6769
if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) {
@@ -167,7 +169,7 @@ public function Analyze() {
167169
case 306: // DateTime
168170
case 315: // Artist
169171
case 316: // HostComputer
170-
$TIFFcommentName = $this->TIFFcommentName($fieldarray['raw']['tag']);
172+
$TIFFcommentName = strtolower($fieldarray['raw']['tag_name']);
171173
if (isset($info['tiff']['comments'][$TIFFcommentName])) {
172174
$info['tiff']['comments'][$TIFFcommentName][] = $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'];
173175
} else {
@@ -224,19 +226,246 @@ public function TIFFcompressionMethod($id) {
224226
* @return string
225227
*/
226228
public function TIFFcommentName($id) {
229+
// https://www.awaresystems.be/imaging/tiff/tifftags.html
227230
static $TIFFcommentName = array();
228231
if (empty($TIFFcommentName)) {
229232
$TIFFcommentName = array(
230-
270 => 'imagedescription',
231-
271 => 'make',
232-
272 => 'model',
233-
305 => 'software',
234-
306 => 'datetime',
235-
315 => 'artist',
236-
316 => 'hostcomputer',
233+
254 => 'NewSubfileType',
234+
255 => 'SubfileType',
235+
256 => 'ImageWidth',
236+
257 => 'ImageLength',
237+
258 => 'BitsPerSample',
238+
259 => 'Compression',
239+
262 => 'PhotometricInterpretation',
240+
263 => 'Threshholding',
241+
264 => 'CellWidth',
242+
265 => 'CellLength',
243+
266 => 'FillOrder',
244+
269 => 'DocumentName',
245+
270 => 'ImageDescription',
246+
271 => 'Make',
247+
272 => 'Model',
248+
273 => 'StripOffsets',
249+
274 => 'Orientation',
250+
277 => 'SamplesPerPixel',
251+
278 => 'RowsPerStrip',
252+
279 => 'StripByteCounts',
253+
280 => 'MinSampleValue',
254+
281 => 'MaxSampleValue',
255+
282 => 'XResolution',
256+
283 => 'YResolution',
257+
284 => 'PlanarConfiguration',
258+
285 => 'PageName',
259+
286 => 'XPosition',
260+
287 => 'YPosition',
261+
288 => 'FreeOffsets',
262+
289 => 'FreeByteCounts',
263+
290 => 'GrayResponseUnit',
264+
291 => 'GrayResponseCurve',
265+
292 => 'T4Options',
266+
293 => 'T6Options',
267+
296 => 'ResolutionUnit',
268+
297 => 'PageNumber',
269+
301 => 'TransferFunction',
270+
305 => 'Software',
271+
306 => 'DateTime',
272+
315 => 'Artist',
273+
316 => 'HostComputer',
274+
317 => 'Predictor',
275+
318 => 'WhitePoint',
276+
319 => 'PrimaryChromaticities',
277+
320 => 'ColorMap',
278+
321 => 'HalftoneHints',
279+
322 => 'TileWidth',
280+
323 => 'TileLength',
281+
324 => 'TileOffsets',
282+
325 => 'TileByteCounts',
283+
326 => 'BadFaxLines',
284+
327 => 'CleanFaxData',
285+
328 => 'ConsecutiveBadFaxLines',
286+
330 => 'SubIFDs',
287+
332 => 'InkSet',
288+
333 => 'InkNames',
289+
334 => 'NumberOfInks',
290+
336 => 'DotRange',
291+
337 => 'TargetPrinter',
292+
338 => 'ExtraSamples',
293+
339 => 'SampleFormat',
294+
340 => 'SMinSampleValue',
295+
341 => 'SMaxSampleValue',
296+
342 => 'TransferRange',
297+
343 => 'ClipPath',
298+
344 => 'XClipPathUnits',
299+
345 => 'YClipPathUnits',
300+
346 => 'Indexed',
301+
347 => 'JPEGTables',
302+
351 => 'OPIProxy',
303+
400 => 'GlobalParametersIFD',
304+
401 => 'ProfileType',
305+
402 => 'FaxProfile',
306+
403 => 'CodingMethods',
307+
404 => 'VersionYear',
308+
405 => 'ModeNumber',
309+
433 => 'Decode',
310+
434 => 'DefaultImageColor',
311+
512 => 'JPEGProc',
312+
513 => 'JPEGInterchangeFormat',
313+
514 => 'JPEGInterchangeFormatLngth',
314+
515 => 'JPEGRestartInterval',
315+
517 => 'JPEGLosslessPredictors',
316+
518 => 'JPEGPointTransforms',
317+
519 => 'JPEGQTables',
318+
520 => 'JPEGDCTables',
319+
521 => 'JPEGACTables',
320+
529 => 'YCbCrCoefficients',
321+
530 => 'YCbCrSubSampling',
322+
531 => 'YCbCrPositioning',
323+
532 => 'ReferenceBlackWhite',
324+
559 => 'StripRowCounts',
325+
700 => 'XMP',
326+
327+
32781 => 'ImageID',
328+
33432 => 'Copyright',
329+
34732 => 'ImageLayer',
330+
331+
// Private Tags - https://www.awaresystems.be/imaging/tiff/tifftags/private.html
332+
32932 => 'Wang Annotation', // Annotation data, as used in 'Imaging for Windows'.
333+
33445 => 'MD FileTag', // Specifies the pixel data format encoding in the Molecular Dynamics GEL file format.
334+
33446 => 'MD ScalePixel', // Specifies a scale factor in the Molecular Dynamics GEL file format.
335+
33447 => 'MD ColorTable', // Used to specify the conversion from 16bit to 8bit in the Molecular Dynamics GEL file format.
336+
33448 => 'MD LabName', // Name of the lab that scanned this file, as used in the Molecular Dynamics GEL file format.
337+
33449 => 'MD SampleInfo', // Information about the sample, as used in the Molecular Dynamics GEL file format.
338+
33450 => 'MD PrepDate', // Date the sample was prepared, as used in the Molecular Dynamics GEL file format.
339+
33451 => 'MD PrepTime', // Time the sample was prepared, as used in the Molecular Dynamics GEL file format.
340+
33452 => 'MD FileUnits', // Units for data in this file, as used in the Molecular Dynamics GEL file format.
341+
33550 => 'ModelPixelScaleTag', // Used in interchangeable GeoTIFF files.
342+
33723 => 'IPTC', // IPTC (International Press Telecommunications Council) metadata.
343+
33918 => 'INGR Packet Data Tag', // Intergraph Application specific storage.
344+
33919 => 'INGR Flag Registers', // Intergraph Application specific flags.
345+
33920 => 'IrasB Transformation Matrix', // Originally part of Intergraph's GeoTIFF tags, but likely understood by IrasB only.
346+
33922 => 'ModelTiepointTag', // Originally part of Intergraph's GeoTIFF tags, but now used in interchangeable GeoTIFF files.
347+
34264 => 'ModelTransformationTag', // Used in interchangeable GeoTIFF files.
348+
34377 => 'Photoshop', // Collection of Photoshop 'Image Resource Blocks'.
349+
34665 => 'Exif IFD', // A pointer to the Exif IFD.
350+
34675 => 'ICC Profile', // ICC profile data.
351+
34735 => 'GeoKeyDirectoryTag', // Used in interchangeable GeoTIFF files.
352+
34736 => 'GeoDoubleParamsTag', // Used in interchangeable GeoTIFF files.
353+
34737 => 'GeoAsciiParamsTag', // Used in interchangeable GeoTIFF files.
354+
34853 => 'GPS IFD', // A pointer to the Exif-related GPS Info IFD.
355+
34908 => 'HylaFAX FaxRecvParams', // Used by HylaFAX.
356+
34909 => 'HylaFAX FaxSubAddress', // Used by HylaFAX.
357+
34910 => 'HylaFAX FaxRecvTime', // Used by HylaFAX.
358+
37724 => 'ImageSourceData', // Used by Adobe Photoshop.
359+
40965 => 'Interoperability IFD', // A pointer to the Exif-related Interoperability IFD.
360+
42112 => 'GDAL_METADATA', // Used by the GDAL library, holds an XML list of name=value 'metadata' values about the image as a whole, and about specific samples.
361+
42113 => 'GDAL_NODATA', // Used by the GDAL library, contains an ASCII encoded nodata or background pixel value.
362+
50215 => 'Oce Scanjob Description', // Used in the Oce scanning process.
363+
50216 => 'Oce Application Selector', // Used in the Oce scanning process.
364+
50217 => 'Oce Identification Number', // Used in the Oce scanning process.
365+
50218 => 'Oce ImageLogic Characteristics', // Used in the Oce scanning process.
366+
50706 => 'DNGVersion', // Used in IFD 0 of DNG files.
367+
50707 => 'DNGBackwardVersion', // Used in IFD 0 of DNG files.
368+
50708 => 'UniqueCameraModel', // Used in IFD 0 of DNG files.
369+
50709 => 'LocalizedCameraModel', // Used in IFD 0 of DNG files.
370+
50710 => 'CFAPlaneColor', // Used in Raw IFD of DNG files.
371+
50711 => 'CFALayout', // Used in Raw IFD of DNG files.
372+
50712 => 'LinearizationTable', // Used in Raw IFD of DNG files.
373+
50713 => 'BlackLevelRepeatDim', // Used in Raw IFD of DNG files.
374+
50714 => 'BlackLevel', // Used in Raw IFD of DNG files.
375+
50715 => 'BlackLevelDeltaH', // Used in Raw IFD of DNG files.
376+
50716 => 'BlackLevelDeltaV', // Used in Raw IFD of DNG files.
377+
50717 => 'WhiteLevel', // Used in Raw IFD of DNG files.
378+
50718 => 'DefaultScale', // Used in Raw IFD of DNG files.
379+
50719 => 'DefaultCropOrigin', // Used in Raw IFD of DNG files.
380+
50720 => 'DefaultCropSize', // Used in Raw IFD of DNG files.
381+
50721 => 'ColorMatrix1', // Used in IFD 0 of DNG files.
382+
50722 => 'ColorMatrix2', // Used in IFD 0 of DNG files.
383+
50723 => 'CameraCalibration1', // Used in IFD 0 of DNG files.
384+
50724 => 'CameraCalibration2', // Used in IFD 0 of DNG files.
385+
50725 => 'ReductionMatrix1', // Used in IFD 0 of DNG files.
386+
50726 => 'ReductionMatrix2', // Used in IFD 0 of DNG files.
387+
50727 => 'AnalogBalance', // Used in IFD 0 of DNG files.
388+
50728 => 'AsShotNeutral', // Used in IFD 0 of DNG files.
389+
50729 => 'AsShotWhiteXY', // Used in IFD 0 of DNG files.
390+
50730 => 'BaselineExposure', // Used in IFD 0 of DNG files.
391+
50731 => 'BaselineNoise', // Used in IFD 0 of DNG files.
392+
50732 => 'BaselineSharpness', // Used in IFD 0 of DNG files.
393+
50733 => 'BayerGreenSplit', // Used in Raw IFD of DNG files.
394+
50734 => 'LinearResponseLimit', // Used in IFD 0 of DNG files.
395+
50735 => 'CameraSerialNumber', // Used in IFD 0 of DNG files.
396+
50736 => 'LensInfo', // Used in IFD 0 of DNG files.
397+
50737 => 'ChromaBlurRadius', // Used in Raw IFD of DNG files.
398+
50738 => 'AntiAliasStrength', // Used in Raw IFD of DNG files.
399+
50740 => 'DNGPrivateData', // Used in IFD 0 of DNG files.
400+
50741 => 'MakerNoteSafety', // Used in IFD 0 of DNG files.
401+
50778 => 'CalibrationIlluminant1', // Used in IFD 0 of DNG files.
402+
50779 => 'CalibrationIlluminant2', // Used in IFD 0 of DNG files.
403+
50780 => 'BestQualityScale', // Used in Raw IFD of DNG files.
404+
50784 => 'Alias Layer Metadata', // Alias Sketchbook Pro layer usage description.
405+
50908 => 'TIFF_RSID', // This private tag is used in a GEOTIFF standard by DGIWG.
406+
50909 => 'GEO_METADATA', // This private tag is used in a GEOTIFF standard by DGIWG.
407+
408+
// EXIF tags - https://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif.html
409+
33434 => 'ExposureTime', // Exposure time, given in seconds.
410+
33437 => 'FNumber', // The F number.
411+
34850 => 'ExposureProgram', // The class of the program used by the camera to set exposure when the picture is taken.
412+
34852 => 'SpectralSensitivity', // Indicates the spectral sensitivity of each channel of the camera used.
413+
34855 => 'ISOSpeedRatings', // Indicates the ISO Speed and ISO Latitude of the camera or input device as specified in ISO 12232.
414+
34856 => 'OECF', // Indicates the Opto-Electric Conversion Function (OECF) specified in ISO 14524.
415+
36864 => 'ExifVersion', // The version of the supported Exif standard.
416+
36867 => 'DateTimeOriginal', // The date and time when the original image data was generated.
417+
36868 => 'DateTimeDigitized', // The date and time when the image was stored as digital data.
418+
37121 => 'ComponentsConfiguration', // Specific to compressed data; specifies the channels and complements PhotometricInterpretation
419+
37122 => 'CompressedBitsPerPixel', // Specific to compressed data; states the compressed bits per pixel.
420+
37377 => 'ShutterSpeedValue', // Shutter speed.
421+
37378 => 'ApertureValue', // The lens aperture.
422+
37379 => 'BrightnessValue', // The value of brightness.
423+
37380 => 'ExposureBiasValue', // The exposure bias.
424+
37381 => 'MaxApertureValue', // The smallest F number of the lens.
425+
37382 => 'SubjectDistance', // The distance to the subject, given in meters.
426+
37383 => 'MeteringMode', // The metering mode.
427+
37384 => 'LightSource', // The kind of light source.
428+
37385 => 'Flash', // Indicates the status of flash when the image was shot.
429+
37386 => 'FocalLength', // The actual focal length of the lens, in mm.
430+
37396 => 'SubjectArea', // Indicates the location and area of the main subject in the overall scene.
431+
37500 => 'MakerNote', // Manufacturer specific information.
432+
37510 => 'UserComment', // Keywords or comments on the image; complements ImageDescription.
433+
37520 => 'SubsecTime', // A tag used to record fractions of seconds for the DateTime tag.
434+
37521 => 'SubsecTimeOriginal', // A tag used to record fractions of seconds for the DateTimeOriginal tag.
435+
37522 => 'SubsecTimeDigitized', // A tag used to record fractions of seconds for the DateTimeDigitized tag.
436+
40960 => 'FlashpixVersion', // The Flashpix format version supported by a FPXR file.
437+
40961 => 'ColorSpace', // The color space information tag is always recorded as the color space specifier.
438+
40962 => 'PixelXDimension', // Specific to compressed data; the valid width of the meaningful image.
439+
40963 => 'PixelYDimension', // Specific to compressed data; the valid height of the meaningful image.
440+
40964 => 'RelatedSoundFile', // Used to record the name of an audio file related to the image data.
441+
41483 => 'FlashEnergy', // Indicates the strobe energy at the time the image is captured, as measured in Beam Candle Power Seconds
442+
41484 => 'SpatialFrequencyResponse', // Records the camera or input device spatial frequency table and SFR values in the direction of image width, image height, and diagonal direction, as specified in ISO 12233.
443+
41486 => 'FocalPlaneXResolution', // Indicates the number of pixels in the image width (X) direction per FocalPlaneResolutionUnit on the camera focal plane.
444+
41487 => 'FocalPlaneYResolution', // Indicates the number of pixels in the image height (Y) direction per FocalPlaneResolutionUnit on the camera focal plane.
445+
41488 => 'FocalPlaneResolutionUnit', // Indicates the unit for measuring FocalPlaneXResolution and FocalPlaneYResolution.
446+
41492 => 'SubjectLocation', // Indicates the location of the main subject in the scene.
447+
41493 => 'ExposureIndex', // Indicates the exposure index selected on the camera or input device at the time the image is captured.
448+
41495 => 'SensingMethod', // Indicates the image sensor type on the camera or input device.
449+
41728 => 'FileSource', // Indicates the image source.
450+
41729 => 'SceneType', // Indicates the type of scene.
451+
41730 => 'CFAPattern', // Indicates the color filter array (CFA) geometric pattern of the image sensor when a one-chip color area sensor is used.
452+
41985 => 'CustomRendered', // Indicates the use of special processing on image data, such as rendering geared to output.
453+
41986 => 'ExposureMode', // Indicates the exposure mode set when the image was shot.
454+
41987 => 'WhiteBalance', // Indicates the white balance mode set when the image was shot.
455+
41988 => 'DigitalZoomRatio', // Indicates the digital zoom ratio when the image was shot.
456+
41989 => 'FocalLengthIn35mmFilm', // Indicates the equivalent focal length assuming a 35mm film camera, in mm.
457+
41990 => 'SceneCaptureType', // Indicates the type of scene that was shot.
458+
41991 => 'GainControl', // Indicates the degree of overall image gain adjustment.
459+
41992 => 'Contrast', // Indicates the direction of contrast processing applied by the camera when the image was shot.
460+
41993 => 'Saturation', // Indicates the direction of saturation processing applied by the camera when the image was shot.
461+
41994 => 'Sharpness', // Indicates the direction of sharpness processing applied by the camera when the image was shot.
462+
41995 => 'DeviceSettingDescription', // This tag indicates information on the picture-taking conditions of a particular camera model.
463+
41996 => 'SubjectDistanceRange', // Indicates the distance to the subject.
464+
42016 => 'ImageUniqueID', // Indicates an identifier assigned uniquely to each image.
237465
);
238466
}
239467
return (isset($TIFFcommentName[$id]) ? $TIFFcommentName[$id] : 'unknown/invalid ('.$id.')');
240468
}
241469

470+
242471
}

0 commit comments

Comments
 (0)