This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

tmpDateString = exifData.Item(ExifDictionary.DateTimeOriginal)

I just try to upgrade the component from 4.5 to 5.0.

I found that i gave error on this line of code
tmpDateString = exifData.Item(Aurigma.GraphicsMill.Codecs.ExifDictionary.DateTimeOriginal)

The error as below:
Run-time exception thrown : System.ArgumentException - The value with the specified key does not exist in collection.
Parameter name: key


The code was working fine under 4.5

Please advice.
Hello,

Could you attach the image file causing the problem?
18:                 Dim formatReader As Codecs.IFormatReader
19:                 formatReader = Codecs.FormatManager.CreateFormatReader(strFileName)
20:                 Dim exifData As Codecs.MetadataDictionary

21:                 Select Case formatReader.MediaFormat
                        Case Codecs.FormatManager.JpegFormat
22:                         Dim jpegReader As Codecs.JpegReader
23:                         jpegReader = CType(formatReader, Codecs.JpegReader)
24:                         exifData = jpegReader.Exif

25:                     Case Codecs.FormatManager.PsdFormat
26:                         Dim psdReader As Codecs.PsdReader
27:                         psdReader = CType(formatReader, Codecs.PsdReader)
28:                         exifData = psdReader.Exif

29:                     Case Codecs.FormatManager.TiffFormat
30:                         Dim tiffReader As Codecs.TiffReader
31:                         tiffReader = CType(formatReader, Codecs.TiffReader)
32:                         exifData = tiffReader.Exif
33:                     Case Else
34:                         Exit Function
35:                         End Select

36:                 Dim tmpDateString As String = ""
37:                 Try
                        tmpDateString = _
                        Format(exifData.Item(Aurigma.GraphicsMill.Codecs.ExifDictionary.DateTimeOriginal), yyyy-mm-dd HH:mm:ss") <- this is where give error
                        '
39:                 Catch ex As Exception
                        tmpDateString = "1601-01-01 00:00:01"
40:                 End Try


Attachments

Hello,

The file you sent doesn't contain such EXIF tag. You should add additional check before using this value using Contains(...) method.
Thanks !!!