Author Topic: Are image files updated in-place, or completely re-written?  (Read 3456 times)

dd-b

  • Jr. Member
  • **
  • Posts: 10
When deleting keywords, and when adding keywords, to a JPEG, TIFF, or camera-original RAW file (Nikon NEF, Fuji S2 RAF, Fuji F11 RW2, Olympus ORF in particular), will the file be completely re-written (copied to a new inode on a Unix box), or are the updates sometimes made in-place or by extending the end of the file?

I ask because I'm gearing up to do a large clean-up of keywording on a lifetime of photos, and they live on ZFS filesystem, and there are snapshots being taken and kept.  Which means that, if the whole file is rewritten, the free space I need to do the clean-up is vastly larger than if the data is mostly updated in-place or by extending the end of the existing file.  I'm using the Perl library interface, not the standalone application.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15224
    • ExifTool Home Page
Re: Are image files updated in-place, or completely re-written?
« Reply #1 on: June 26, 2017, 11:57:36 AM »
ExifTool always creates a new output file.  The original is not touched unless you specify -overwrite_original (in which case the output file is renamed to replace the original), or -overwrite_original_in_place (in which case the contents of the output file are used to overwrite the original, and the output file is deleted).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2838
Re: Are image files updated in-place, or completely re-written?
« Reply #2 on: June 26, 2017, 01:03:50 PM »
You might want to look into XMP sidecar files to see if that would work better for you.  If your software supports them, that is.  Smaller files that mean less impact on your snapshots.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

dd-b

  • Jr. Member
  • **
  • Posts: 10
Re: Are image files updated in-place, or completely re-written?
« Reply #3 on: June 26, 2017, 01:22:16 PM »
Too many other programs in the toolchain don't support sidecar files. Also, part of what I'm doing is fixing accumulated errors (I guess some bits of the collected images go back 23 years; that's their digital representations, the images themselves some of them go back 60 years on film), and standardizing some things, so I need to take out existing keywords.

dd-b

  • Jr. Member
  • **
  • Posts: 10
Re: Are image files updated in-place, or completely re-written?
« Reply #4 on: June 27, 2017, 06:57:43 PM »
So, given the write-and-rename process you describe, I have to worry very little about file damage in crashes (or from SIGINT), it sounds like. The rename is atomic, and aborting anything else at worst leaves a temp file with a funny name sitting around?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15224
    • ExifTool Home Page
Re: Are image files updated in-place, or completely re-written?
« Reply #5 on: June 28, 2017, 07:01:25 AM »
Correct.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dd-b

  • Jr. Member
  • **
  • Posts: 10
Re: Are image files updated in-place, or completely re-written?
« Reply #6 on: June 28, 2017, 12:46:25 PM »
You might want to look into XMP sidecar files to see if that would work better for you.

Although, on looking more deeply into how Photo Mechanic and Adobe products handle sidecar files, maybe that *is* a useful solution.  Because there's just *one* crucial program in the toolchain that doesn't handle them, and giving it up might be easier than replacing all the production and backup disks with bigger ones.