Main Menu

JSON examples

Started by lamarve, December 11, 2013, 12:42:42 PM

Previous topic - Next topic

lamarve

Hi,

I am very new at image manipulation. I am trying to overwrite the existing metadata and replace it with a json table. I could really use an example jsonfile and command line to accomplish this. I have enclosed my output from my asp.net project. I am using windows shell to run exiftool. Please let me know if you need more information.

Any help you can give me is appreciate,

Robert Evans
robert.evans@yahoo.com

Phil Harvey

Hi Robert,

I really don't know how you want to store this JSON information.  It could be simply done by storing it as a PNG comment, like this:

exiftool "-comment<=BadgeTest.txt" jsontest.png

- 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

But I'm thinking that probably isn't what you want to do.  To write standard metadata as individual tags from the contents of a JSON file is easy, like this:

exiftool -json=test.json image.png

and the format of the JSON file is exactly the same as the output of this command:

exiftool -json image.png

The "SourceFile" entry is mandatory and must match your target file name (or be "*" to match any file).  The rest of the entries are for the tags you want to write.

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

lamarve

Yes That is what I am looking to do. Source file entry is confusing me however. Can I have additional explanation or a sample of the test.json file.

Thanks in advance,

RCE

Phil Harvey

The 2nd command I gave generates a test.json file for you.  (OK, well add "> test.json" to the end of the command to actually write the output to "test.json".)

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

lamarve

I am trying to import json data into an image to create an Mozilla open badges compliant image. Am I working in the wrong direction? My specific needs are to erase all metadata associated with an image and add 30 or so key/value pairs in 4 or 5 groups. From reading the documentation it appears that I could wipe out all information in the image and add new key/value pairs from a text file. Is that correct? If so is there a short tutorial or sample of what that file might look like along with command line.

Any help you can give me is appreciated,

RCE
robert.evans@yahoo.com

Phil Harvey

I have no idea what comprises a "Mozilla open badges compliant" PNG image, so I can't help at all here.  But if you can figure that out, you can certainly write the metadata from an input JSON file (among other ways) using ExifTool.

I already gave you an example of what the JSON file looks like, and command line examples of how to read/write metadata to/from the JSON file.

Also, you could try reading the exiftool application documentation.

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