Go to:  Davar site entry | Site contents | Site index | Miscellaneous | Downloads | Text bottom

RENPHOT  Digital  Photo  Image  File  Renaming  (16-bit)

RENPHOT procedure (external program executable from DOS/Windows command session) generates unique names for image files recorded by a digital camera based on date-time stamps contained within the files.  This program, as most of utility programs, was written to a great degree out of desire to avoid the necessity of a tedious manual work that could be relatively easy automated.

Its origin goes back to late 1998 when my brother Victor and I had switched simultaneously to the digital photography.  We had both chosen Olympus 400D, which at that time was the only digital camera on the market that combined four very important for us characteristics:

This doesn't look as great features these days (several years later), but at that time there was much less choice, and ours, as we believed, was close to an optimum.  Digital cameras were very expensive back then, but given our intensity of taking photos and an average price of film developing and printing pictures, we've calculated that in several years we'll break even, so that all our digital photography would become only for the negligible price of the regular AA batteries.  It was important that this camera provided for most of our basic photography needs, and thus it stays useful years later, despite becoming obsolete when compared with other contemporary options (by the year 2005 we've both switched to Canon PowerShot S1-IS).

One of the important reasons behind switching to digital photography was our hope that we'll get an easier and more effective way to organize our vast photo archives using computer, and it will put an end to the everlasting job of sorting out shoeboxes full of pictures and squeezing them into photo albums.  Now, several years later, this expectation finally came true and thousands of photos can be packed on a piece of plastic (CD-R) that is cheaper than the price of a single photo print.  But in order to have any value, this mass of images has to be structured into a directory hierarchy that would permit an obvious and quick access.

The foundation of such hierarchy is the system of naming the individual pictures.  Unfortunately names being generated by the digital camera are hardly usable for this purpose.  Olympus 400D, for example, generates file names as Pmddnnnn, where m is the last digit of current month number, dd is current day number, and nnnn is sequential number of the picture within the the flash cartridge (normally around 40 High Quality compressed picture files fit on one 8 Mb standard cartridge).

Given the potentially large number of photo image files it was necessary to choose some simple and formal method for naming pictures, and the obvious way, of course, was to use the date and time stamp, which got recorded with the image.  Our early attempts to rename files manually, though quite pathetic, pushed us in the right direction, and pretty soon Victor, who used to take much more pictures than myself, got irritated first, and came out with an idea to let computer do image file renaming, and has drafted the spec for the initial version of RENPHOT.  PowerBASIC was more of my tool, so I had to pick up the programming.

The initial version of the program renamed image files using their recorded date-time stamp, and generated image directory DESCRIPT.ION file for later adjustment and use with ACDSee Classic image file viewer and manager.  (DESCRIPT.ION is the file within a directory that holds descriptions of directory files – an old, simple and flexible technique to have a logical equivalent of the Long File Names within 8.3 file naming scheme.)  Date and time stamp was extracted from the fixed place within image file.  As we've been using RENPHOT after the initial version was written, it became clear that certain enhancements would be beneficial, and they got incorporated into the following versions of the program.  The latest version is a flexible program that searches date-time stamp dynamically, and thus is usable for renaming files recorded by different digital cameras.  It has a detailed parameter control of its execution modes, and has provisions both to control and to resolve automatically certain potential renaming conflicts.  It permits also to specify a global description, which is a major time-saving feature when used properly.

Since RENPHOT selects image date dynamically, both in terms of position within the JPG file and the number of date occurrence, it should, at least theoretically, work with any photo JPG files.  However, I'm well aware of the fact that "In theory, theory and practice are the same, in practice they are different".  So if you'll encounter a digital photo JPG file that this program fails to rename, please e-mail it to as a file attachment, and I'll make necessary changes to handle the new format.  (Please remember that if date is not present in the file header, either because digital camera was not set to record it, or because it was removed by image processing program, RENPHOT won't be able to rename such file; files with entirely digital names are not renamed as well to permit a safe reprocessing of previously processed directory.)

It is important to understand that RENPHOT does not change in any way the contents of image files, and thus would never damage your images.  It only renames image files, and, even in case of mistaken application, the worst consequence is an unwanted renaming, which is not a problem either, since new names contain the same data as old (camera recorded) names, as well as time component that keeps new names in the same order as the old ones.

Below there is a brief description of RENPHOT operation modes extracted from program text.  Please look through it in order to understand the basic program functionality and the use of its control parameters.  You can get more details about RENPHOT program and examples of its functioning in the PowerBASIC section.


' Description --------------------------------------------------------------

'    Program generates unique names for image files recorded by a digital
'    camera basing on date-time stamps contained within files.  Generated
'    file names are unique only within the given year - it's not much of a
'    trouble to separate files between years, while this limitation permits
'    to maintain the most universal 8.3 naming standard.  Ideally a digital
'    camera itself should do this job, but file naming seems to be of a
'    little concern for camera designers.

'    Program reads all not entirely digitally named *.JPG files within the
'    CURRENT directory and renames those that have recorded date and time
'    stamp (non-zero).  Recorded date and time can be adjusted by a fixed
'    value to handle the situation when pictures were taken in a time zone
'    different from one where camera clock was set, or to correct error of
'    the camera clock.  Along with file renaming program appends records
'    to the DESCRIPT.ION file providing initial description approximations
'    (with optional global comment) that can be adjusted manually later.

' Parameters (Up to 7 Positional Self-Delimited) ---------------------------

'    1. Global description comment to be added to every description line
'       (might be handy as an event or place identification that can be
'       later individually adjusted as necessary for selected images).

'    2. Date-time stamp delimiter recorded by the camera (Default:  ":").

'    3. Number of date-time stamp entry to select (Default:  2).  Camera
'       usually writes several dates (Olympus writes 3, for example) and
'       certain investigation and trial might be required to determine what
'       date-time stamp is the most reliable (for Olympus D400 it happens
'       to be the 2-nd date).

'    4. Name of the last file from the previous memory cartridge in the form
'       of an eight-digit number "MODAHRUT" (Default or invalid:  none).
'       This parameter might prove handy for downloading and renaming images
'       from several successive memory cartridges in case of a high frequency
'       of shots made at the end of one cartridge that results in the
'       incremental shift of file name numbers, so that this shift carries
'       over into the next cartridge.  This might happen because it's
'       necessary to download separate cartridges into separate directories
'       - camera provides unique names only within its current cartridge.
'       There's always a choice, of course, not to use this parameter, but
'       to do necessary image file name adjustments manually when merging
'       individual cartridge directories together.

'    5. Date translation pattern (Default:  "MO/DA/CNYE")
'       Date is recorded by the camera as "CNYE:MO:DA" (":" stands here
'       for the camera-recorded date-time stamp delimiter), where:
'          CN  - Current century
'          YE  - Year  of current century
'          MO  - Month of current year
'          DA  - Day   of current month
'       Pattern for the date to be written to the corresponding line of
'       DESCRIPT.ION file can be composed of above listed date fields
'       and any delimiters different from DAMOYECN characters, e.g.:
'       MO/DA/CNYE  or  MO/DA/YE
'       DA.MO.CNYE  or  DA.MO.YE
'       CNYE-MO-DA  or  YE-MO-DA, etc.

'    6. Time translation pattern (Default:  "HR:UT")
'       Time is recorded by the camera as "HR:UT:SZ" (":" stands here
'       for the camera-recorded date-time stamp delimiter), where:
'          HR  - Hour   of current day
'          UT  - Minute of current hour
'          SZ  - Second of current minute
'       Pattern for the time to be written to the corresponding line of
'       DESCRIPT.ION file can be composed of above listed time fields
'       and any delimiters different from HRUTSZ characters, e.g.:
'       HR:UT:SZ  or  HR:UT
'       HR.UT.SZ  or  HR.UT
'       HR-UT/SZ  or  HR-UT, etc.

'    7. Time adjustment increment/decrement (Default:  none), e.g.:
'       +08:00  or   -02:30  - Should have fixed sHR:UT format, when specified.
'       HR<=12  and  UT<=59  - Invalid parameter (format or value) is ignored.
'       Time adjustment comes handy in case you've been travelling, and taking
'       pictures in another time zone, but didn't adjust the camera clock
'       (who does?).  This might be a minor annoyance, but why not to fix it
'       in the same run with image files' renaming?
'       It's sufficient, of course, to have only hours for time zone adjustment;
'       minutes are added just in case it would be desirable to correct an error
'       of the camera clock.
'       Be careful with the sign setting; you've got to have it "+", if
'       pictures were taken East of the location where camera clock was set
'       (things happen "earlier" there), and "-", if pictures were taken West.

'    Note:  In order to permit any symbols within global description comment,
'          and to accommodate for any possible recorded date-time stamp
'          delimiter, and any delimiters within date and time patterns,
'          parameter string is treated as being self-delimited, i.e. its
'          FIRST symbol is used as the delimiter of individual parameters.
'          It is up to the user to specify delimiter with the parameters
'          and to choose it carefully to avoid parameter misinterpretation.

'          RENPHOT                              - All parameters defaulted
'          RENPHOT _Comment, etc.               - Symbol "_" is the delimiter
'          RENPHOT /Comment, etc./:              - Symbol "/" is the delimiter
'          RENPHOT \Comment, etc.\:\1           - Symbol "\" is the delimiter
'          RENPHOT |Comment, etc.|:|3|04121443  - Symbol "|" is the delimiter

' Action -------------------------------------------------------------------

'  - Reads date and time stamp from every *.JPG file in the CURRENT directory
'    in the form of CNYE:MO:DA HR:UT:SZ (":" is assumed to be date delimiter).

'  - Renames each file into MODAHRUT.JPG using data from date and time stamp.
'                           +>+>+>+>
'                           | | | v
'                           | | v Minute (can be incremented over 59 to 99)
'                           | v Hour (can be incremented over 23, if required)
'                           v Day
'                           Month

'  - In case such name already exists, name is incremented by "+1" until
'    proper vacant name slot is found (the ACTUAL time is placed in the
'    description record).  Such incrementing might move the minute field
'    over 59 to 99 and under very rare circumstances hour field over 23.
'    (It's not a big deal to keep file name always as a proper date, but
'    it might tend to propagate the shift beyond month and even beyond year,
'    which doesn't make any sense.)

'  - Image description record is appended to DESCRIPT.ION file for future
'    use as ACDSee and 4DOS description line.  Description record has the
'    following format (includes WeeK Day identification):
'    MODAHRUT.JPG WKD MO/DA/CNYE HR:UT  [<global_description_comment>]

'    Note:   Date and time are translated according to the default pattern
'           in the above example.  Alternative translation patterns can be
'           specified.

' Notes --------------------------------------------------------------------

'  - Program is designed to operate within CURRENT directory.

'  - Important presumption is that file names written by the camera are not
'    entirely digital (E.g.:  they start with "P" for Olympus).

'  - If file name is entirely digital (except for ".JPG" extension) no
'    action is taken for such file.  This ensures that partially processed
'    directories can be entirely reprocessed safely to rename only what is
'    required.

'  - Program relies on the metadata with the date-time stamp that gets
'    written at the beginning of the *.JPG image file by a digital camera.
'    If date and time stamp is not found or it is all zeros, no action is
'    taken for such file (camera should be set to write date and time to
'    image file). To check the presence of metadata and date-time stamp
'    view *.JPG file as text.

'  - Renaming of image files should be done right after unloading them from
'    the camera to the computer.  If you plan to use RENPHOT, it should be
'    the very FIRST processing step.  Image processing programs such as
'    ACDSee or PhotoShop remove camera-recorded metadata (they give warning,
'    however), and date-time stamp gets lost, making operation of RENPHOT
'    impossible (running it anyway won't spoil anything - files simply won't
'    be renamed).

'  - Beginning of the date-time stamp is identified by the program as four
'    successive digits starting with "19" or "20" followed by the date
'    delimiter, E.g.:   "19yy:" or "20yy:".

'  - Program looks for date-time stamp only within first 1000 symbols of
'    *.JPG file.  If the number of date-time entry specified by the 3-rd
'    parameter is not found, file is not renamed.
        

RENPHOT program should be run from the DOS/Windows command session, and within the current directory of photo image files that have to be renamed.  Presuming that RENPHOT.EXE was downloaded to C:\PBASIC directory, that picture files were moved from the camera memory cartridge to the F:\P-020511 directory, and that most of the pictures from that cartridge were taken in Ridgewood, NJ, the sequence below presents a typical example of RENPHOT operation.

RENPHOT operation is illustrated below by a series of vital data snapshots.



   Path:  F:\P-020511
   —————————————————————————————————————————————————————
   P4210001         .JPG  206,109 .a.. 21-04-02 10:10:36
   P4210002         .JPG  197,963 .a.. 21-04-02 10:11:12
   P4230003         .JPG  215,858 .a.. 23-04-02 19:27:30
   P4270004         .JPG  215,679 .a.. 27-04-02 16:58:46
   P4270005         .JPG  189,099 .a.. 27-04-02 16:59:02
   P5010006         .JPG  198,392 .a..  1-05-02 23:43:00
   P5030007         .JPG  206,139 .a..  3-05-02 19:58:12
   P5030008         .JPG  196,896 .a..  3-05-02 19:58:28
   P5030009         .JPG  206,353 .a..  3-05-02 20:12:02
   P5030010         .JPG  194,808 .a..  3-05-02 20:52:52
   P5030011         .JPG  197,808 .a..  3-05-02 20:53:02
   P5040012         .JPG  210,280 .a..  4-05-02 10:53:36
   P5040013         .JPG  215,686 .a..  4-05-02 10:54:00
   P5040014         .JPG  179,422 .a..  4-05-02 10:54:14
   P5040015         .JPG  184,853 .a..  4-05-02 10:54:34
   P5070016         .JPG  184,344 .a..  7-05-02 20:26:52
   P5070017         .JPG  196,939 .a..  7-05-02 20:27:02
   P5080018         .JPG  169,276 .a..  8-05-02 20:41:16
   P5080019         .JPG  164,621 .a..  8-05-02 20:41:32
   P5080020         .JPG  194,775 .a..  8-05-02 20:42:04
   P5090021         .JPG  181,559 .a..  9-05-02 19:34:06
   P5110022         .JPG  214,143 .a.. 11-05-02 12:11:04
   P5110023         .JPG  214,963 .a.. 11-05-02 12:11:14
   P5110024         .JPG  215,848 .a.. 11-05-02 12:11:28
        
      


 FILE:  F:\P-020511\P4210001.JPG
 ————————————————————————————————————————————————————————————————————————————
  00000000  ......Exif..II*........... .....................................
  00000040  ..............................(...........1...........2.........
  00000080  ..............i...............OLYMPUS DIGITAL CAMERA         .OL
  000000C0  YMPUS OPTICAL CO.,LTD.C900Z,D400Z...H.......H.......v872-72.....
  00000100  ....................2002:04:21 10:10:36...........*...........2.
  00000140  ..'.......d...........0210........:...........N.................
  00000180  ......b...........j...........r.................................
  000001C0  ..............z...|.......|.......}...............0100..........
  00000200  ..................................^.............................
  00000240  ......2002:04:21 10:10:36.2002:04:21 10:10:36...................
  00000280  ......8...............
  000002C0
  00000300             .......................N...........V...(.............
  00000340  ..........................H.......H.................R98.........
  00000380  0100....OLYMP...................................................
  000003C0  ......................"...........*...........6.......4...>.....
  00000400  .. ...z...........................................d.............
  00000440  ..SR872...[pictureInfo] Resolution=2 [Camera Info] Type=SR872...
  00000480  ......OLYMPUS DIGITAL CAMERA.............../@.............+....g
        
    


   F:\P-020511>RENPHOT /Ridgewood, NJ
   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-29-2002  23:09
   ---------------------------------------------------------------------
   P4210001.JPG --> 04211010.JPG  2002:04:21 10:10:36
   P4210002.JPG --> 04211011.JPG  2002:04:21 10:11:12
   P4230003.JPG --> 04231927.JPG  2002:04:23 19:27:30
   P4270004.JPG --> 04271658.JPG  2002:04:27 16:58:46
   P4270005.JPG --> 04271659.JPG  2002:04:27 16:59:02
   P5010006.JPG --> 05012343.JPG  2002:05:01 23:43:01
   P5030007.JPG --> 05031958.JPG  2002:05:03 19:58:12
   P5030008.JPG --> 05031959.JPG  2002:05:03 19:58:29
   P5030009.JPG --> 05032012.JPG  2002:05:03 20:12:03
   P5030010.JPG --> 05032052.JPG  2002:05:03 20:52:52
   P5030011.JPG --> 05032053.JPG  2002:05:03 20:53:03
   P5040012.JPG --> 05041053.JPG  2002:05:04 10:53:36
   P5040013.JPG --> 05041054.JPG  2002:05:04 10:54:00
   P5040014.JPG --> 05041055.JPG  2002:05:04 10:54:15
   P5040015.JPG --> 05041056.JPG  2002:05:04 10:54:35
   P5070016.JPG --> 05072026.JPG  2002:05:07 20:26:52
   P5070017.JPG --> 05072027.JPG  2002:05:07 20:27:02
   P5080018.JPG --> 05082041.JPG  2002:05:08 20:41:16
   P5080019.JPG --> 05082042.JPG  2002:05:08 20:41:32
   P5080020.JPG --> 05082043.JPG  2002:05:08 20:42:04
   P5090021.JPG --> 05091934.JPG  2002:05:09 19:34:06
   P5110022.JPG --> 05111211.JPG  2002:05:11 12:11:05
   P5110023.JPG --> 05111212.JPG  2002:05:11 12:11:14
   P5110024.JPG --> 05111213.JPG  2002:05:11 12:11:28
        
      


   Path:  F:\P-020511
   —————————————————————————————————————————————————————
   04211010         .JPG  206,109 .a.. 21-04-02 10:10:36
   04211011         .JPG  197,963 .a.. 21-04-02 10:11:12
   04231927         .JPG  215,858 .a.. 23-04-02 19:27:30
   04271658         .JPG  215,679 .a.. 27-04-02 16:58:46
   04271659         .JPG  189,099 .a.. 27-04-02 16:59:02
   05012343         .JPG  198,392 .a..  1-05-02 23:43:00
   05031958         .JPG  206,139 .a..  3-05-02 19:58:12
   05031959         .JPG  196,896 .a..  3-05-02 19:58:28
   05032012         .JPG  206,353 .a..  3-05-02 20:12:02
   05032052         .JPG  194,808 .a..  3-05-02 20:52:52
   05032053         .JPG  197,808 .a..  3-05-02 20:53:02
   05041053         .JPG  210,280 .a..  4-05-02 10:53:36
   05041054         .JPG  215,686 .a..  4-05-02 10:54:00
   05041055         .JPG  179,422 .a..  4-05-02 10:54:14
   05041056         .JPG  184,853 .a..  4-05-02 10:54:34
   05072026         .JPG  184,344 .a..  7-05-02 20:26:52
   05072027         .JPG  196,939 .a..  7-05-02 20:27:02
   05082041         .JPG  169,276 .a..  8-05-02 20:41:16
   05082042         .JPG  164,621 .a..  8-05-02 20:41:32
   05082043         .JPG  194,775 .a..  8-05-02 20:42:04
   05091934         .JPG  181,559 .a..  9-05-02 19:34:06
   05111211         .JPG  214,143 .a.. 11-05-02 12:11:04
   05111212         .JPG  214,963 .a.. 11-05-02 12:11:14
   05111213         .JPG  215,848 .a.. 11-05-02 12:11:28
   DESCRIPT         .ION    1,200 .a.. 29-05-02 23:09:14
        
      


   FILE:  F:\P-020511\DESCRIPT.ION
   ————————————————————————————————————————————————
   04211010.JPG Sun 04/21/2002 10:10  Ridgewood, NJ
   04211011.JPG Sun 04/21/2002 10:11  Ridgewood, NJ
   04231927.JPG Tue 04/23/2002 19:27  Ridgewood, NJ
   04271658.JPG Sat 04/27/2002 16:58  Ridgewood, NJ
   04271659.JPG Sat 04/27/2002 16:59  Ridgewood, NJ
   05012343.JPG Wed 05/01/2002 23:43  Ridgewood, NJ
   05031958.JPG Fri 05/03/2002 19:58  Ridgewood, NJ
   05031959.JPG Fri 05/03/2002 19:58  Ridgewood, NJ
   05032012.JPG Fri 05/03/2002 20:12  Ridgewood, NJ
   05032052.JPG Fri 05/03/2002 20:52  Ridgewood, NJ
   05032053.JPG Fri 05/03/2002 20:53  Ridgewood, NJ
   05041053.JPG Sat 05/04/2002 10:53  Ridgewood, NJ
   05041054.JPG Sat 05/04/2002 10:54  Ridgewood, NJ
   05041055.JPG Sat 05/04/2002 10:54  Ridgewood, NJ
   05041056.JPG Sat 05/04/2002 10:54  Ridgewood, NJ
   05072026.JPG Tue 05/07/2002 20:26  Ridgewood, NJ
   05072027.JPG Tue 05/07/2002 20:27  Ridgewood, NJ
   05082041.JPG Wed 05/08/2002 20:41  Ridgewood, NJ
   05082042.JPG Wed 05/08/2002 20:41  Ridgewood, NJ
   05082043.JPG Wed 05/08/2002 20:42  Ridgewood, NJ
   05091934.JPG Thu 05/09/2002 19:34  Ridgewood, NJ
   05111211.JPG Sat 05/11/2002 12:11  Ridgewood, NJ
   05111212.JPG Sat 05/11/2002 12:11  Ridgewood, NJ
   05111213.JPG Sat 05/11/2002 12:11  Ridgewood, NJ
        
    

And finally, several recommendations from my experience of using the RENPHOT program described above.  These advices might be of some use to you before you'll figure out what your own preferences are.


View RENPHOT program description       Download RENPHOT.EXE file
(Use [Back] button or [Alt]+[CL] to return here from the viewed page)
Copyright © 1999–2004 by
Go to:  Davar site entry | Site contents | Site index | Miscellaneous | Downloads | Text top