Author Topic: EXIF Tags  (Read 5581 times)

Offline qprjohn

  • Newcomer
  • *
  • Posts: 13
    • View Profile
EXIF Tags
« on: April 03, 2014, 01:23:56 AM »
Can you help me with a couple of questions regarding EXIF tags.

I've used various software applications to read the metadata in various JPEG's but cannot see any tags that denote if the image has been locked in the camera to prevent deletion.

When PM ingests files it sets the "tagged" tag to true or false to indicate this. Please can you tell me which tag is used from the camera's metadata to ascertain if it's true or false? (I use Canon 1D Mk3 & 4 and 1Dx)

Using VB.Net I have written some code that will write the description and caption directly into the metadata of an image (JPEG), whilst it shows the updated caption/description in various applications like Windows Explorer, Photoshop and various metadata viewers, it does not reflect this in PM. It still shows the original description/captions even after completely closing PM and restarting the PC. Does PM use it's own XMP sidecar?

Thanking you in advance.

Offline qprjohn

  • Newcomer
  • *
  • Posts: 13
    • View Profile
Re: EXIF Tags
« Reply #1 on: April 03, 2014, 02:39:29 AM »
Sorry forgot to add - Win 7 Professional/PM5
« Last Edit: April 03, 2014, 04:42:02 AM by qprjohn »

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: EXIF Tags
« Reply #2 on: April 03, 2014, 07:10:48 AM »
Can you help me with a couple of questions regarding EXIF tags.

I've used various software applications to read the metadata in various JPEG's but cannot see any tags that denote if the image has been locked in the camera to prevent deletion.

When PM ingests files it sets the "tagged" tag to true or false to indicate this. Please can you tell me which tag is used from the camera's metadata to ascertain if it's true or false? (I use Canon 1D Mk3 & 4 and 1Dx)

There is no EXIF tag that indicates the locked status.  It is a filesystem value.  The file is "write-protected".  PM sees this and determines that the image was "locked".

Using VB.Net I have written some code that will write the description and caption directly into the metadata of an image (JPEG), whilst it shows the updated caption/description in various applications like Windows Explorer, Photoshop and various metadata viewers, it does not reflect this in PM. It still shows the original description/captions even after completely closing PM and restarting the PC. Does PM use it's own XMP sidecar?

No.  But PM definitely prefers to use the description found in IPTC and XMP over the EXIF "Description" tag.  PM will only show the contents of the EXIF "Description" tag as a last resort (when there is no IPTC or XMP caption.)  The reason for that being that it is a very old way of describing an image and there is no way to tell what encoding is used for the text, unlike IPTC which supports a few encodings and XMP which is Unicode.

If you're starting this coding from scratch, you'll save yourself a lot of time by using ExifTool (either by simply utilizing it, or by calling out to it via ShellExecute() from your app).  ExifTool can do incredible things with an amazing number of image formats.  PM doesn't use it, but it is very capable and it is quite quick about it.

HTH,

-Kirk

Offline qprjohn

  • Newcomer
  • *
  • Posts: 13
    • View Profile
Re: EXIF Tags
« Reply #3 on: April 03, 2014, 07:48:13 AM »
Thank you very much for the information regarding the write protect info. Much appreciated.

I will need to find out what part of the metadata my code is writing to. If I can identify what is happening I'll let you know.

I've looked at ExifTool, it's written in C#, I use VB and unfortunately my knowledge of C# is limited.

Thank you very much.  :)

Offline qprjohn

  • Newcomer
  • *
  • Posts: 13
    • View Profile
Re: EXIF Tags
« Reply #4 on: April 03, 2014, 08:13:12 AM »
Kirk

Tried the filesystem value approach, works a treat thank you. (I looked at EXIF data for hours!)

Found this Function -

    Function IsFileReadOnly(ByVal FileName As String) As Boolean
        ' Create a new FileInfo object.
        Dim fInfo As New FileInfo(FileName)

        ' Return the IsReadOnly property value.
        Return fInfo.IsReadOnly

    End Function

John

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: EXIF Tags
« Reply #5 on: April 03, 2014, 08:39:02 AM »
Thank you very much for the information regarding the write protect info. Much appreciated.

I will need to find out what part of the metadata my code is writing to. If I can identify what is happening I'll let you know.

I've looked at ExifTool, it's written in C#, I use VB and unfortunately my knowledge of C# is limited.

Thank you very much.  :)

ExifTool is written in Perl.  But you can execute it from your program using the Windows ShellExecute (or ShellExecuteEx) API.  You don't have to know how or program in Perl in order to execute it.

-Kirk

Offline qprjohn

  • Newcomer
  • *
  • Posts: 13
    • View Profile
Re: EXIF Tags
« Reply #6 on: April 05, 2014, 02:26:57 AM »
Kirk

My mistake regarding ExifTool being written in C#, I was in fact looking at a VB Project called exifeditor in VS 2010 written in C++, I also found another project written in VB called ExifWorks.

I have to say that they were a bit above my head!

As far as I can see the metadata tag PM uses to show the Description/Caption is found in the "Dublin Core Properties" under the "description" tag. I modified my code to write the caption to this tag, it now shows in PM.

Thanks again for your help.




Offline qprjohn

  • Newcomer
  • *
  • Posts: 13
    • View Profile
Re: EXIF Tags
« Reply #7 on: April 06, 2014, 02:12:30 AM »
Kirk

Sorry to keep asking you these questions as they are not a PM issue, but I have encountered another issue that you may be able to help me with.

I can write metadata to the images successfully now. However when I try to retrieve it back to show in a text box if the metadata is not a simple string but has carraige returns and linefeeds I get an error saying that it cannot convert bitmapdata to a string? I'm using the "setquery" and "getquery" methods in vb.net.

I've searched many forums and MSDN's website but found nothing that directly answers the problem. Is it something to do do with encoding the metadata?

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: EXIF Tags
« Reply #8 on: April 06, 2014, 06:17:01 AM »
Hard to say.  It sounds like the parser has run into the actual image data before it found the string data you're looking for.

-Kirk