Author Topic: JSON examples  (Read 5098 times)

lamarve

  • Newbie
  • *
  • Posts: 3
JSON examples
« on: December 11, 2013, 12:42:42 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16902
    • ExifTool Home Page
Re: JSON examples
« Reply #1 on: December 11, 2013, 12:57:10 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16902
    • ExifTool Home Page
Re: JSON examples
« Reply #2 on: December 11, 2013, 01:12:06 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lamarve

  • Newbie
  • *
  • Posts: 3
Re: JSON examples
« Reply #3 on: December 11, 2013, 01:25:45 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16902
    • ExifTool Home Page
Re: JSON examples
« Reply #4 on: December 11, 2013, 01:27:52 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lamarve

  • Newbie
  • *
  • Posts: 3
Re: JSON examples
« Reply #5 on: December 11, 2013, 01:42:47 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16902
    • ExifTool Home Page
Re: JSON examples
« Reply #6 on: December 11, 2013, 01:44:10 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).