Author Topic: Renaming with {frame4} variable  (Read 2828 times)

Offline crunge

  • Newcomer
  • *
  • Posts: 12
    • View Profile
Renaming with {frame4} variable
« on: March 03, 2009, 10:49:29 AM »
I'm running into some problematic behavior when I use the {frame} and {frame4} variables to rename photos.

The first time I run the rename function all appears to work well. For example, assuming the following original filenames

_CJR2945.NEF (from a Nikon D3)
_DSC0670.NEF (from a Nikon D90)
IMG_0330.CR2 (from a Canon Powershot G9)

and a rename macro of

CJR_{datesort}_{frame4}

I get the following filenames:

CJR_20081115_0330.CR2
CJR_20090103_0670.NEF
CJR_20090103_2945.NEF

In each case the Preview Info screen shows the correct frame number both before and after the rename.

At this point, if I rename again using the same macro everything is still correct and the Preview Info screen is also correct. However, if I close the contact sheet and reopen it with the same files, I now have different behavior:
(1) the CR2 file from the Canon G9 no longer shows the frame number on the Preview Info screen
(2) attempting to rename with the same macro at this point will rename the Nikon files correctly (e.g. their name stays the same) but the Canon CR2 file will be renamed to CJR_20081115_.CR2 (presumably because it can no longer detect a frame number on that file for some reason).

Note: if I manually rename the CR2 file back to the original filename of IMG_0330.CR2 it is able to rename the file probably without problem, but only for so long as I leave the contact sheet open.

One other interesting observation: For the Nikon files, if I manually rename the original files to some number other than the actual number originally used (e.g., _DSC0670.NEF is manually renamed to _DSC1111.NEF), Photo Mechanic is able to still pick out the correct frame number (0670) and applies that to the file rename. This is good. However, this does not work for the Canon files. If I rename the Canon file from IMG_0330.CR2 to IMG_1113.CR2 it now thinks the frame number is 1113, not 0330. My assumption is that Photo Mechanic is able to read the frame number out of EXIF for the Nikon files and not out of the Canon files (perhaps because in the latter case it doesn't exist?)

To sum up this lengthy post: if there's anything that can be done to avoid the problem where the frame number for Canon files is "forgotten" after renaming and closing the contact sheet, even when the frame number is in a similar 4-digit format to the original prior to the rename, it would be greatly appreciated. Bulk renaming files to find out that some now have no frame number leads to ugly looking filenames.

This is all with 4.6 on a Mac.


Offline karlmz

  • Member
  • **
  • Posts: 64
    • View Profile
Re: Renaming with {frame4} variable
« Reply #1 on: March 03, 2009, 11:06:00 AM »
Try using {filenamebase:-4,4} instead of {frame4}. By doing that you always preserve the four last digits of the file name base (the file name without the extension).

Regards,

Karl

Offline devenh

  • Sr. Member
  • ****
  • Posts: 435
    • View Profile
Re: Renaming with {frame4} variable
« Reply #2 on: March 03, 2009, 01:32:33 PM »
I haven't run into the problem you described, but with NEF files I have noticed that the EXIF frame number sometimes is lost after editing with NX, which results in frame4 being useless for renaming.  As a result, I refrain from using frame4 after files have been edited.

I did a quick check of my files, and it appears the problem was solved with NX2, so maybe this is no longer a concern.

Deven

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20150
    • View Profile
    • Camera Bits, Inc.
Re: Renaming with {frame4} variable
« Reply #3 on: March 03, 2009, 01:58:10 PM »
I'm running into some problematic behavior when I use the {frame} and {frame4} variables to rename photos.

The first time I run the rename function all appears to work well. For example, assuming the following original filenames

_CJR2945.NEF (from a Nikon D3)
_DSC0670.NEF (from a Nikon D90)
IMG_0330.CR2 (from a Canon Powershot G9)

and a rename macro of

CJR_{datesort}_{frame4}

I get the following filenames:

CJR_20081115_0330.CR2
CJR_20090103_0670.NEF
CJR_20090103_2945.NEF

In each case the Preview Info screen shows the correct frame number both before and after the rename.

At this point, if I rename again using the same macro everything is still correct and the Preview Info screen is also correct. However, if I close the contact sheet and reopen it with the same files, I now have different behavior:
(1) the CR2 file from the Canon G9 no longer shows the frame number on the Preview Info screen
(2) attempting to rename with the same macro at this point will rename the Nikon files correctly (e.g. their name stays the same) but the Canon CR2 file will be renamed to CJR_20081115_.CR2 (presumably because it can no longer detect a frame number on that file for some reason).

Note: if I manually rename the CR2 file back to the original filename of IMG_0330.CR2 it is able to rename the file probably without problem, but only for so long as I leave the contact sheet open.

One other interesting observation: For the Nikon files, if I manually rename the original files to some number other than the actual number originally used (e.g., _DSC0670.NEF is manually renamed to _DSC1111.NEF), Photo Mechanic is able to still pick out the correct frame number (0670) and applies that to the file rename. This is good. However, this does not work for the Canon files. If I rename the Canon file from IMG_0330.CR2 to IMG_1113.CR2 it now thinks the frame number is 1113, not 0330. My assumption is that Photo Mechanic is able to read the frame number out of EXIF for the Nikon files and not out of the Canon files (perhaps because in the latter case it doesn't exist?)

To sum up this lengthy post: if there's anything that can be done to avoid the problem where the frame number for Canon files is "forgotten" after renaming and closing the contact sheet, even when the frame number is in a similar 4-digit format to the original prior to the rename, it would be greatly appreciated. Bulk renaming files to find out that some now have no frame number leads to ugly looking filenames.

This is all with 4.6 on a Mac.

If you use Photo Mechanic's Ingest function to download your images, PM will keep track of the inferred frame number and the {frame4} variable will continue to work.  How did you get your images onto your computer?  The reason your NEF files continue to work is because we have some code that parses Nikon's maker notes and finds that data.  On Canon cameras we do the same thing but Canon keeps on changing their maker note data making it a cat-and-mouse game for us.  We don't have a Canon G9 so we haven't attempted to update our Canon maker note parsing to work with it.  Nikon hasn't changed their format of this data for some time now.

-Kirk
« Last Edit: March 03, 2009, 02:00:39 PM by Kirk Baker »

Offline crunge

  • Newcomer
  • *
  • Posts: 12
    • View Profile
Re: Renaming with {frame4} variable
« Reply #4 on: March 03, 2009, 04:22:34 PM »
Karl: thanks for the tip on {filenamebase:-4,4}

Kirk: these particular files were copied over manually using the Finder. I'll be happy to provide files for the Canon G9 if that would help with the marker note issue. Just let me know how.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20150
    • View Profile
    • Camera Bits, Inc.
Re: Renaming with {frame4} variable
« Reply #5 on: March 03, 2009, 04:44:55 PM »
Karl: thanks for the tip on {filenamebase:-4,4}

Kirk: these particular files were copied over manually using the Finder. I'll be happy to provide files for the Canon G9 if that would help with the marker note issue. Just let me know how.

That's fine. Please click on my name to the left of this message, then click on the 'personal message' link.  I will respond with upload instructions.

But I seriously recommend that you use Ingest rather than drag and drop with the Finder.  It's too easy to make mistakes with that method.

-Kirk