Run-time error '-2145320854 (8021006a)': Automation error, while accessing image properties

101 Views Asked by At

I am trying to find duplicate images, following a simple (and rudimentary) logic. If two images were taken at the same exact time, and are identical in size, chances are they must be duplicates.

Here's my relevant code

Set ImgFile = New WIA.ImageFile
ImgFile.LoadFile (fullFilePath)
If (Right(fullFilePath, 3) = "JPG") Then
  ImgFile.LoadFile (fullFilePath)
  pictureTaken = ImgFile.Properties("DateTime")
End If

It extracts the "picture taken" property accurately for most images, but once in a while it encounters an image that does not have that property set. That's when it throws the runtime error.

I'll take any advice about the specific error message (or a better approach to the problem I am trying to solve).

0

There are 0 best solutions below