ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: DarkJaff on August 24, 2011, 12:18:16 PM

Title: Modifying the ExifByteOrder
Post by: DarkJaff on August 24, 2011, 12:18:16 PM
Hello everyone (and maybe Phil if you are out there!)

I have an 3rd party application that read JPEG file for special visualisation purpose. Unfortunatly, when the file have the "ExifByteOrder" to big-endian, it doesn't work. I guess this application needs some information in the exif header and can't read it because it doesn't  handle the endianness of the file.

So my question is, how can I change the endianness of my file with exiftool? I tried a lot of thing but nothing work. I've read in the Extra tag documentation that this field (ExifByteOrder) can be changed (writable) but only while creating new file. So maybe all I need is the command line to create a new file from another one while copying everything else but the ExifByteOrder and changing it to Little-Endian.

Anyway, waiting for your help because I'm stucked   :P

Thanks a lot!

DarkJaff
Title: Re: Modifying the ExifByteOrder
Post by: Phil Harvey on August 24, 2011, 01:17:32 PM
Hi DarkJaff,

Try this:

exiftool -all= -tagsfromfile test.jpg -all:all -unsafe -exifbyteorder=little-endian test.jpg

This is a bit tricky because you must specify the file name twice in the command.  Using -tagsFromFile @ doesn't work in this case because it changes the order of operations so the tags are copied last, including the ExifByteOrder tag from the source file, which would override the ExifByteOrder we want to set on the command line.

This command deletes all metadata from the image, then rebuilds it with the specified byte order.  Note that while this should work, in general I don't advise changing the EXIF byte order like this because it is too easy to corrupt information (particularly proprietary information).

- Phil

Edit: I just noticed that this technique is discussed in FAQ number 20 (https://exiftool.org/faq.html#Q20).

Update: As of ExifTool 8.70, the order of operations is now consistent when used in batch mode or not.  So in the command above, @ may be used for the -tagsFromFile argument with ExifTool 8.70 or later.
Title: Re: Modifying the ExifByteOrder
Post by: DarkJaff on August 25, 2011, 08:14:40 AM
Hi Phil,

You just saved our project! It work perfectly and prove that the 3rd party software was not reading exif header taking care of the byte order and only support little-endian (which is bad!).

I'm thinking about using the C# wrapper to do this inside our software. Will it be possible to do the exact same command as you post in your answer? Anyway, I will try it today.

Also, my biggest concern is about the licence of Exiftool (in fact, it's the biggest concern of my boss). I've read the licence but I'm not too sure about the legal stuff. We have a commercial application and we will use the exiftool.exe or C# exiftool wrapper inside our application. It will be transparent to the final user (in fact, the final user will not even know that exiftool exist). What licence is applicable in this case? Can we use it?

Thanks a lot for your time and help!

DarkJaff
Title: Re: Modifying the ExifByteOrder
Post by: Phil Harvey on August 25, 2011, 08:37:29 AM
I don't know about the C# wrapper, you'll have to try it to see what it's capabilities are.

From the Perl artistic license:

QuoteAggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution.

Basically, this means that you are free to use exiftool in your commercial application as you described.

- Phil
Title: Re: Modifying the ExifByteOrder
Post by: DarkJaff on August 26, 2011, 11:53:29 AM
Thanks a lot.

Just one last thing, when I use this command, it create another file (a backup file I think) with the extension .jpg_original. What is the parameter so exiftool do not create this backup file?

Thanks!
Have a great week-end
Title: Re: Modifying the ExifByteOrder
Post by: Phil Harvey on August 26, 2011, 12:24:13 PM
That would be the -overwrite_original option.

- Phil

Title: Re: Modifying the ExifByteOrder
Post by: marjue on August 28, 2013, 08:00:09 AM
Hi Phil

I need exactly this but in Perl. Could you please post a syntax example. I'm trying for hours now without success.

Thanx


Marcus
Title: Re: Modifying the ExifByteOrder
Post by: Phil Harvey on August 30, 2013, 07:17:33 AM
Hi Marcus,

You mean something like this?:

my $et = new Image::ExifTool;
$et->SetNewValue(all => undef);
$et->SetNewValuesFromFile($srcFile, 'all:all', 'unsafe');
$et->SetNewValue(ExifByteOrder => 'little-endian');
$et->WriteInfo($dstFile);


- Phil
Title: Re: Modifying the ExifByteOrder
Post by: marjue on August 30, 2013, 02:45:31 PM
Hi Phil

Thanx a lot .... the example helped!

I did the same expect the "$et->SetNewValue(all => undef);" line.

The reason for this all is Lightroom 5. It was not able to import my generated JPEG files.


Bye
Marcus
Title: Re: Modifying the ExifByteOrder
Post by: Phil Harvey on August 31, 2013, 06:08:32 AM
This call does the same thing as "-all=" on the command line.

- Phil