copying from NEF file to jpg omitting multisegment exif information

Started by jörgens.mi, July 19, 2024, 10:21:32 AM

Previous topic - Next topic

jörgens.mi

With my new camera a nikon z6iii i have problems copying the exif information to a jpg file without any exifs
Tagsfromfile seems to copy the information, but any further command
will give the following error

c:\bat\exiftool.exe -k  -api nomultiexif -n "-Orientation=1"  *.jpg
Warning: [minor] File contains multi-segment EXIF - N63_jm001372_ji.jpg
Error: EXIF is too large for JPEG segment - N63_jm001372_ji.jpg
    1 files weren't updated due to errors

After searching i tried the following, excluding the big binary tags
c:\bat\exiftool  -api nomultiexif -x previewimage -x jpgfromraw -tagsfromfile  N63_
jm001262.nef N63_jm001262_ji.jpg
Warning: [minor] Writing large value for MakerNotes - N63_jm001262_ji.jpg
Error: EXIF is too large for JPEG segment - N63_jm001262_ji.jpg
    0 image files updated
    1 files weren't updated due to errors

No sucess


I want to copy the information from the nef to the jpg  in a single segment- the contents shall be the same as in the file generated by "exiftool a.nef >exif.asc" the binary information are not of an interest.

When I look for the output from exiftool, the nef file has only 11k  my pentax have a 23k exif file and works without any problems.

Can you help me, please

StarGeek

Is there any particular reason you're including the -api NoMultiExif option? The first command is failing because the image probably already has a multi-segment EXIF block.

In the second command, have you checked to see if there is already a multi-segment EXIF block in the jpeg file? Because that would also cause a failure because exiftool isn't removing the old EXIF block, just copying new data to it. Plus, the preview images are going to still going to be in the JPEG unless you remove them, which would probably force the creation of a multi-segment EXIF block anyway. Copying new data will not remove pre-existing data.

Also, the second command is going to create several new tags in XMP (see FAQ #9, "The tag locations change when I use -tagsfromfile to copy information").

For the second command, try this
exiftool -api nomultiexif -EXIF:All= -TagsFromFile N63_jm001262.nef -EXIF:All --Preview:all N63_jm001262_ji.jpg

This will remove the EXIF block, including the existing preview images, from the JPEG. It will then copy all the EXIF data from the NEF file without changing the locations or creating new tags in other groups, while not copying
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

jörgens.mi

Thanks a lot for very fast reply.

My workflow is as follows
I'm generating my jpgs starting with the nef-Files using Adobe Camera Raw followed by Photoshop exporting as bmp file.
Using a tool to generate the jpg's
Afterwards
1: c:\bat\exiftool.exe -all= filename
2: c:\bat\exiftool.exe -api nomultiexif -x previewimage -x jpgfromraw -tagsfromfile  infile.nef outfile.nef
3  c:\bat\exiftool.exe "-Artist=Nickname: joergens.mi" "-By-line=Nickname: joergens.mi"  ....  "-Source=eigene Aufnahme"  "-Keywords=Zelt Musik Festival 2024" *.jpg
4: c:\bat\exiftool.exe -api nomultiexif -n "-Orientation=1"  *.jpg
5: c:\bat\exiftool.exe -api nomultiexif "-filemodifydate<datetimeoriginal" *.jpg

Following step  2 all will fail, at the moment I set the orientation with irfanview - by hand -

Exchanging step 3 with 2 will successfully  add the information. but step 4 and 5 can't be moved before Step 2.

I've seen your recommendation and will try it, as soon as possible.


jörgens.mi

I'm sorry
this causes the following error

exiftool -api nomultiexif -EXIF:All= -TagsFromFile ..\N63_jm005816.nef
 -EXIF:All --Preview:all N63_jm005816_ji.jpg

Warning: [minor] Writing large value for MakerNotes - N63_jm005816_ji.jpg
Error: EXIF is too large for JPEG segment - N63_jm005816_ji.jpg
    0 image files updated
    1 files weren't updated due to errors

I can provide you with an nef and an jpg for testing

StarGeek

As I asked in my first post, why are you including the -api NoMultiExif option?

If you could provide a NEF, then that would be useful. A JPEG isn't needed. The only reason I'd look at that is because my camera is an old model and maybe there is something about your NEF that might be giving a different result than I get.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

I'll have to take a look at my z6iii samples to see what Nikon writes to the JPEG.  If some makernotes tags aren't found in JPEG then I can drop them during the copy, but if some tags are just smaller it will be difficult to know what to do.  I'll post back here when I know more.

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

jörgens.mi

Here is a nef file and the according generated jpg file
The file is generated with the following process NEF -> Adobe Camera Raw -> Photoshop -> jpg-illuminator -> jpg

jpg-illuminator ( https://www.jpg-illuminator.de ) is small german tool to konvert bmp tiff to jpg and do some samll manipilations on them. 

Sorry I can't send the nef here, is ther an alternative for 36 MB sized file

StarGeek

Quote from: jörgens.mi on July 20, 2024, 03:58:59 PMSorry I can't send the nef here, is ther an alternative for 36 MB sized file

Dropbox, Google drive, Mega.nz, sites of that nature.

One free site is Wormhole.App. It will hold a file for 24 hours and then delete it and it does not need an account.  I wouldn't use it with any file that has very personal data, i.e. tax records and such, but it works well with random photos.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

I downloaded some Z6iii samples from photographyblog.com.  Here is the problem:

In JPG images (from the exiftool -v3 output):

  | | | 58) ShotInfo02xx (SubDirectory) -->
  | | |     - Tag 0x0091 (37508 bytes, undef[37508]):

but in NEF images:

  | | | 62) ShotInfo02xx (SubDirectory) -->
  | | |     - Tag 0x0091 (65120 bytes, undef[65120]):

Dropping this when copying to JPG would result in the loss of some potentially useful information (although ExifTool is currently only extracting the FirmwareVersion from this).

I'll have to spend some time looking at this data and see if there is a way to decide how much of it to drop when copying the MakerNotes.  I'll also have to create a mechanism to do this because currently it is all or nothing when deciding if a makernote tag should be copied.

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

jörgens.mi

Thanks a lot for your investigations.

How can I copy the Information without the (all) makernotes.

When I use an alternative developmentpath --  acr -> photoshop -> export as jpg -> adding iptc information with adobe bridge  -- this works fine.

Phil Harvey

Quote from: jörgens.mi on July 23, 2024, 04:00:40 PMHow can I copy the Information without the (all) makernotes.

This is the command I would use to copy all EXIF except the makernotes from NEF to JPG, overwriting existing EXIF:

exiftool -exif:all= -tagsfromfile %d%f.nef -exif:all --makernotes -ext jpg DIR

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

Phil Harvey

I'll patch ExifTool 12.90 to drop this tag if larger than 50000 bytes.  Simply truncating it isn't possible due to its structure.  I could rebuild it if necessary with the appropriate section missing, but this gets complicated because I would have to change all the offsets and reencrypt the record.

There are 29 sections in the Z6iii ShotInfo structure, and the offsets/sizes are as follows for JPG and NEF images:

JPG  Offset Size   NEF  Offset Size
  0) 0x0000 0        0) 0x009c 21604
  1) 0x0000 0        1) 0x5500 6008
  2) 0x009c 2528     2) 0x6c78 2528
  3) 0x0a7c 200      3) 0x7658 200
  4) 0x0b44 2488     4) 0x7720 2488
  5) 0x14fc 1468     5) 0x80d8 1468
  6) 0x1ab8 1032     6) 0x8694 1032
  7) 0x1ec0 256      7) 0x8a9c 256
  8) 0x1fc0 800      8) 0x8b9c 800
  9) 0x22e0 144      9) 0x8ebc 144
 10) 0x2370 64      10) 0x8f4c 64
 11) 0x0000 0       11) 0x0000 0
 12) 0x23b0 5009    12) 0x8f8c 5009
 13) 0x3741 1536    13) 0xa31d 1536
 14) 0x3d41 11928   14) 0xa91d 11928
 15) 0x6bd9 5937    15) 0xd7b5 5937
 16) 0x830a 500     16) 0xeee6 500
 17) 0x84fe 160     17) 0xf0da 160
 18) 0x859e 464     18) 0xf17a 464
 19) 0x876e 8       19) 0xf34a 8
 20) 0x8776 64      20) 0xf352 64
 21) 0x87b6 6       21) 0xf392 6
 22) 0x87bc 48      22) 0xf398 48
 23) 0x87ec 20      23) 0xf3c8 20
 24) 0x8800 108     24) 0xf3dc 108
 25) 0x886c 8       25) 0xf448 8
 26) 0x8874 2420    26) 0xf450 2420
 27) 0x0000 0       27) 0x0000 0
 28) 0x0000 0       28) 0x0000 0

Sections 0 and 1 exist in the NEF but not the JPG, and these are the reason for the change.  Other sections are all the same size between NEF and JPG.  Too bad these are at the start of the record -- if they were at the end then a simple truncation would be possible.

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

jörgens.mi

I want to say thank you.

Both works fine for me
the new Version 12.91
and your tip how to copy without makernotes.


I would be curious what these 29 sections are, but it is not important

Phil Harvey

Quote from: jörgens.mi on July 28, 2024, 09:26:15 AMI would be curious what these 29 sections are

Some of these have been decoded for other Nikon Z cameras.  See the ShotInfoZ7II Tags for example.

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