DExif-Package中某些字段的Compliererror

DExif-Package中某些字段的Compliererror

问题描述:

我安装了DEXIF包,能够读取一些EXIF条目。但不是文档中描述的计算值。 以下代码显示了什么可行。对于注释行我得到的错误:标识符idents没有成员“focalLenght”等。 我怎样才能得到这些和更多的领域?DExif-Package中某些字段的Compliererror

procedure TForm1.EXIFAnzeigen(filename: string); 
var 
    ImgData: TImgData; 
    i :integer; 
begin 
    //EDitor leeren 

    ValueListEditor1.Strings.Clear; 
    if FileExists(filename) then begin 
    ImgData:= TImgData.Create(); 
    ImgData.Tracelevel :=1; 
    try 
     if uppercase(ExtractFileExt(filename)) = '.JPG' then begin 
      if ImgData.ProcessFile(filename) then begin 
       if ImgData.HasEXIF then begin 
       ValueListEditor1.InsertRow('Camera Make', 
       ImgData.ExifObj.CameraMake,True); 
       ValueListEditor1.InsertRow('Camera Modell', 
       ImgData.ExifObj.CameraModel,True); 
       ValueListEditor1.InsertRow('Picture DateTime', 
       FormatDateTime(ISO_DATETIME_FORMAT, ImgData.ExifObj.GetImgDateTime),True); 
       ValueListEditor1.InsertRow('Width', 
       inttostr(ImgData.ExifObj.Width),True); 
       ValueListEditor1.InsertRow('FlashUsed', 
       intToStr(ImgData.ExifObj.FlashUsed),True); 

//    ValueListEditor1.InsertRow('FocalLength', 
//    inttostr(ImgData.ExifObj.FocalLength),True); 
//    ValueListEditor1.InsertRow('ApertureFNumber', 
//    ImgData.ExifObj.ApertureFNumber,True); 
//    ValueListEditor1.InsertRow('ExposureTime', 
//    ImgData.ExifObj.ExposureTime,True); 
//    ValueListEditor1.InsertRow('Distance', 
//    ImgData.ExifObj.Distance,True); 
//    ValueListEditor1.InsertRow('Process', 
//    ImgData.ExifObj.Process,True); 
       end else begin 
        ValueListEditor1.InsertRow('No EXIF','No Data',True); 
       end; 
      end else begin 
       ValueListEditor1.InsertRow('No EXIF','Processdata',True); 
      end; 
     end else begin 
      ValueListEditor1.Strings.Clear; 
     end; 
    finally 
     ImgData.Free; 
    end; 
    end; 
end; 
+0

你有没有尝试阅读源代码以查看哪些属性可用以及何时(以及如何)使用它们? –

+0

我确实在搜索代码,但没有在任何地方找到'FocalLenght'。只需阅读文档。 – ratmalwer

+0

嗯,它不是'FocalLenght',它是'FocalLength',如果你按照你在文章和最后评论中拼写的方式来搜索它,你显然不会找到它。如果您为搜索拼写正确,但没有找到它,则不在此处。 –

documentation说:

Some of the more common fields are accessible as properties of the EXIFObj of the ImgData.

,并给出了一个例子读这些属性,部分和你一样成功与您的代码阅读。

FocalLength,并在你的代码失败的人,已经用另一种方法为文档进行访问说:

Other EXIF field can be read by using the property TagValue and specifying the name of the EXIF property

下面的例子阐明:

ValueListEditor1.InsertRow('FocalLength', 
inttostr(ImgData.ExifObj.TagValue['FocalLength']),True); 
+0

谢谢..帮助!我可以用这种方法访问更多的标签。但是我不得不更深入一些标签名称,因为我没有找到我期望的标签名称。在网上找到这个列表:http://www.exiv2.org/tags.html但我必须检查名称是否符合DEXIF及其结果。 – ratmalwer

+0

当然,更好地坚持'dEXIF'中的名称或根据需要添加可能的新名称。这是一个完全不同的话题。在每个项目之前添加一个检查,如'If ImgData.ExifObj.TagValue ['FocalLength'] null then',以避免错误 –

+0

好主意如果我有能力给DEXIF添加名字......我现在就来看看我更了解它。周末愉快 !!! – ratmalwer