Author Topic: ExifTool completely breaks when doing a full metadata rewrite from stdin  (Read 2920 times)

Bilge

  • Full Member
  • ***
  • Posts: 36
The following command will destroy the image data retaining just the metadata.

Code: [Select]
exiftool - -all= -tagsfromfile @ -all:all -unsafe <in.jpg >out.jpg
I use exiftool exclusively with piped data so this is a big problem for me. Can this be fixed, Phil?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
You're right, that won't work.  Interesting though.  I'll have to think about this...

- 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 ($).

Bilge

  • Full Member
  • ***
  • Posts: 36
This is the last piece to a puzzle I have worked on for over a year. I'm counting on you, Phil!  :)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
It was actually a bit tricky since I had to buffer the input in memory because this command reads the file twice, but I have something that seems to work now, but it needs more testing.

If you can run the Perl version, you can help with testing.  I have uploaded a pre-release here.

- 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 ($).

Bilge

  • Full Member
  • ***
  • Posts: 36
There was ever a non-Perl version? This version seems to be working for me  :)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
Great, let me know if you have any problems.

The non-Perl version would be the Windows executable (which is really just a bundled Perl version).

- 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 ($).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
I have officially released version 9.28 now.  There are substantial changes since the pre-release because I discovered some problems when combined with other options.  There may still be some lingering problems if people try to do some obscure things (like using the -fileOrder option with stdin as the input, which doesn't make sense of course), but at least it should be better now than it was.

- 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 ($).

Bilge

  • Full Member
  • ***
  • Posts: 36
OK Phil I will upgrade to the official release for production use! Do you anticipate any other issues when using the command outlined in the OP that I should look out for?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
The original command you gave is quite simple (no extraneous options that may compete for the stdin/stdout streams), so it should be perfectly fine.  The only potential issue is that this technique requires the entire file to be buffered in memory, so you need enough available memory to cover this.

- 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 ($).