-json and -jpgfromraw

Started by ludde_t, February 18, 2023, 07:08:18 AM

Previous topic - Next topic

ludde_t

Hi,
Trying to get exiftool to both extract -jpgfromraw and -json exif output in the same command but I am failing miserably. Is it possible?
Thanks!

ludde_t

To clarify the goal is not having to run exiftool twice on the same image to both extract the preview and get the exif-data...

Phil Harvey

All you need to do is add the -b option.

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

ludde_t

Thanks for the reply!
exiftool -json -b -jpgfromraw test.nef > test.jpg
Successfully generates the preview-jpg but does not output the json as
exiftool -json test.nef. does

What am I doing wrong? Want to capture the json to parse it with PHP and add it to a db..

Phil Harvey

Remove the -jpgfromraw to extract all tags.

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

ludde_t

Thanks, but the end goal is to do both? Trying to avoid doing both
exiftool-b -jpgfromraw test.nef > test.jpg
exiftool -json test.nef

But achieving the same result? E.g parsing the json and getting a preview-jpeg outputted to a file..?

Phil Harvey

This command extracts both:

exiftool -json -b test.nef

but you'll have to write the JpgFromRaw to file yourself (after decoding from base64, which should be easy).

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

ludde_t

Thanks! Finally figured it out. Was easy when i figured the base64 was prefixed.. :)

Phil Harvey

Glad you figured it out.

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