EXIF is a common form of meta-data that is embedded in images, typically by digital cameras to provide photographic information.
ImageEn supports EXIF for the following formats (* indicated reading only):
◼JPEG
◼TIFF
◼PNG (from "eXIf", "iTXt", "zTXt" and "tEXt" chunks) *
◼PSD
◼HDP
◼Camera RAW *
If an image contains EXIF data, EXIF_HasEXIFData will be true after loading. Set EXIF_HasEXIFData to true, if you add EXIF data to an image, or set to false to clear EXIF data.
| Demos\InputOutput\EXIF\EXIF.dpr |
General EXIF TagsPhotographic EXIF TagsGPS EXIF TagsEXIF Methods◼Inject EXIF into a TIFF image using
InjectTIFFEXIF or JPEG image using
InjectJpegEXIF (to avoid resaving the image)
◼To determine if a file type supports EXIF use
SupportsInfo◼Clear the EXIF from a file using
ResetInfo◼To use the
embedded thumbnail in EXIF data to speed up thumbnail display in
TImageEnMView, you can enable
EnableLoadEXIFThumbnails◼You can use the
TIEMetaListView to display and edit EXIF fields
label1.Caption := 'Horz. Resolution: ' + ImageEnView1.IO.Params.EXIF_XResolution2;
label2.Caption := 'Vert. Resolution: ' + ImageEnView1.IO.Params.EXIF_YResolution2;
label3.Caption := 'Exposure Time: ' + ImageEnView1.IO.Params.EXIF_ExposureTime2;
label4.Caption := 'F-Number: ' + ImageEnView1.IO.Params.EXIF_FNumber2;
label5.Caption := 'Shutter Speed: ' + ImageEnView1.IO.Params.EXIF_ShutterSpeedValue2;
label6.Caption := 'Aperture: ' + ImageEnView1.IO.Params.EXIF_ApertureValue2;
label7.Caption := 'Max Aperture: ' + ImageEnView1.IO.Params.EXIF_MaxApertureValue2;
// Update EXIF date for the current file
ImageEnView1.IO.Params.EXIF_DateTime2 := Now;
ImageEnView1.IO.Params.EXIF_DateTimeOriginal2 := Now;
ImageEnView1.IO.Params.EXIF_HasEXIFData := True;
ImageEnView1.IO.InjectJpegEXIF( ImageEnView1.IO.Params.Filename );
// Remove EXIF data from image.jpg
ImageEnView1.IO.Params.EXIF_HasExifData := False;
ImageEnView1.IO.SaveToFile('D:\image.jpg'); // Or use InjectJpegEXIF to avoid resaving the image
// Update the GPS EXIF data in a file
io := TImageEnIO.create(nil);
try
io.ParamsFromFile( FilenameStr );
io.Params.EXIF_GPSLatitude := GPSLatitudeFloat;
io.Params.EXIF_GPSLongitude := GPSLongitudeFloat;
io.Params.EXIF_GPSVersionID := GPS_Version_ID;
io.Params.EXIF_HasEXIFData := True;
io.InjectJpegEXIF( FilenameStr );
finally
io.Free;
end;
// Write EXIF GSP data to the current file
ImageEnView1.IO.Params.EXIF_GPSLatitude := StrToFloat( edtEXIF_GPSLatitude.Text );
ImageEnView1.IO.Params.EXIF_GPSLongitude := StrToFloat( edtEXIF_GPSLongitude.Text );
ImageEnView1.IO.Params.EXIF_GPSVersionID := GPS_Version_ID;
ImageEnView1.IO.InjectJpegEXIF('D:\GPSStamped.jpg');
// Write a comment to the file
ImageEnView1.IO.LoadFromFile('C:\input.jpg');
ImageEnView1.IO.Params.EXIF_UserComment := 'Hello World!';
ImageEnView1.IO.Params.EXIF_UserCommentCode := IEExifUserCommentCode_Unicode;
ImageEnView1.IO.Params.EXIF_HasEXIFData := true;
ImageEnView1.IO.SaveToFileTIFF('D:\test.tiff');
// Read back the comment
ImageEnView1.IO.LoadFromFileTIFF('D:\test.tiff');
ShowMessage( ImageEnView1.IO.Params.EXIF_UserComment );
See Also
◼ResetEXIF◼GetMetaData◼#EXIF Tags