Project

General

Profile

Feature #1054

Overhaul exiv2json.cpp to build a deeply recursive JSON tree of XMP data

Added by Robin Mills over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
metadata
Target version:
Start date:
10 Apr 2015
Due date:
% Done:

100%

Estimated time:

Description

See discussion: http://dev.exiv2.org/boards/3/topics/1951 Submitted: r3666.


Files

BabyGnuTux-BigWLPG.jpg (119 KB) BabyGnuTux-BigWLPG.jpg Robin Mills, 10 Apr 2015 09:18

Associated revisions

Revision 3666 (diff)
Added by Robin Mills over 6 years ago

#1054. Overhauled exiv2json to recursively build a JSON tree. See discussion: http://dev.exiv2.org/boards/3/topics/1951

Revision 3672 (diff)
Added by Robin Mills over 6 years ago

#1054. Replaced the reference mess with a beautiful one-line recursion. Interation is interesting; recursion is really elegant.

Revision 3676 (diff)
Added by Robin Mills over 6 years ago

#1054. Final polish and comments about the recursion.

Revision 3678 (diff)
Added by Robin Mills over 6 years ago

#1054. More polishing. Adding clarification to the recursion. Other code simplification/elimination.

Revision 3705 (diff)
Added by Robin Mills over 6 years ago

#1054. Write LangAltValue as json object "lang" : { "en-US":"...." , ... }

Revision 3714 (diff)
Added by Robin Mills over 6 years ago

#1054. exiv2json deep recursion and AltLang support. Regression detector.

History

#1

Updated by Robin Mills over 6 years ago

  • Tracker changed from Bug to Feature
#2

Updated by Robin Mills over 6 years ago

600 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ ../bin/exiv2json a ~/Downloads/BabyGnuTux-BigWLPG.jpg | expand -t 2
{
  "FS": {
    "path": "\/Users\/rmills\/Downloads\/BabyGnuTux-BigWLPG.jpg",
    "realpath": "\/Users\/rmills\/Downloads\/BabyGnuTux-BigWLPG.jpg",
    "st_dev": 16777220,
    "st_ino": 51155556,
    "st_mode": 33188,
    "st_nlink": 1,
    "st_uid": 501,
    "st_gid": 20,
    "st_rdev": 0,
    "st_size": 121943,
    "st_atime": 1428657394,
    "st_mtime": 1427548635,
    "st_ctime": 1427548635,
    "st_blksize": 4096,
    "st_blocks": 240
  },
  "Exif": {
    "Image": {
      "Orientation": 1,
      "XResolution": [
        720090,
        10000
      ],
      "YResolution": [
        720090,
        10000
      ],
      "ResolutionUnit": 2,
      "Software": "Adobe Photoshop CS5 Windows",
      "DateTime": "2012:01:04 20:34:45",
      "ExifTag": 164
    },
    "Photo": {
      "ColorSpace": 1,
      "PixelXDimension": 1600,
      "PixelYDimension": 800
    },
    "Thumbnail": {
      "Compression": 6,
      "XResolution": [
        72,
        1
      ],
      "YResolution": [
        72,
        1
      ],
      "ResolutionUnit": 2,
      "JPEGInterchangeFormat": 302,
      "JPEGInterchangeFormatLength": 3586
    }
  },
  "Xmp": {
    "xmp": {
      "CreatorTool": "Adobe Photoshop CS5 Windows",
      "CreateDate": "2012-01-04T20:32:52+01:00",
      "ModifyDate": "2012-01-04T20:34:45+01:00",
      "MetadataDate": "2012-01-04T20:34:45+01:00" 
    },
    "dc": {
      "format": "image\/jpeg" 
    },
    "photoshop": {
      "ColorMode": "3",
      "ICCProfile": "sRGB IEC61966-2.1" 
    },
    "xmpMM": {
      "InstanceID": "xmp.iid:4E9C1E280B37E111A568FF94F417581A",
      "DocumentID": "xmp.did:4D9C1E280B37E111A568FF94F417581A",
      "OriginalDocumentID": "xmp.did:4D9C1E280B37E111A568FF94F417581A",
      "History": [
        {
          "stEvt": {
            "action": "created",
            "instanceID": "xmp.iid:4D9C1E280B37E111A568FF94F417581A",
            "when": "2012-01-04T20:32:52+01:00",
            "softwareAgent": "Adobe Photoshop CS5 Windows" 
          }
        },
        {
          "stEvt": {
            "action": "converted",
            "parameters": "from image\/png to image\/jpeg" 
          }
        },
        {
          "stEvt": {
            "action": "saved",
            "instanceID": "xmp.iid:4E9C1E280B37E111A568FF94F417581A",
            "when": "2012-01-04T20:34:45+01:00",
            "softwareAgent": "Adobe Photoshop CS5 Windows",
            "changed": "\/" 
          }
        }
      ]
    },
    "MP": {
      "RegionInfo": {
        "MPRI": {
          "Regions": [
            {
              "MPReg": {
                "Rectangle": "0.661608, 0.244310, 0.130501, 0.261002",
                "PersonDisplayName": "Baby Tux" 
              }
            },
            {
              "MPReg": {
                "Rectangle": "0.205615, 0.226100, 0.130501, 0.261002",
                "PersonDisplayName": "Baby Gnu" 
              }
            }
          ]
        }
      }
    }
  }
}
#3

Updated by Robin Mills over 6 years ago

r3705. Write LangAltValue as json object: { "lang" : { "en-US" : "..." } , ... }

714 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ exiv2 -px ~/R.jpg
Xmp.xmp.Rating                               XmpText     1  0
Xmp.xmp.ModifyDate                           XmpText    25  2015-02-13T20:46:51-06:00
Xmp.dc.description                           LangAlt     1  lang="x-default" Mrs Johnson's Austin Office
715 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ exiv2 -M'set Xmp.dc.title lang="en-us" Sunrise on the beach' ~/R.jpg
716 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ exiv2 -M'set Xmp.dc.title lang="de-DE" Zee towels ease on zee deck-chairs' ~/R.jpg
717 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ exiv2 -px ~/R.jpg
Xmp.xmp.Rating                               XmpText     1  0
Xmp.xmp.ModifyDate                           XmpText    25  2015-02-13T20:46:51-06:00
Xmp.dc.description                           LangAlt     1  lang="x-default" Mrs Johnson's Austin Office
Xmp.dc.title                                 LangAlt     2  lang="en-US" Sunrise on the beach, lang="de-DE" Zee towels ease on zee deck-chairs
718 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ ../bin/exiv2json -x ~/R.jpg 
{
    "Xmp": {
        "xmp": {
            "Rating": "0",
            "ModifyDate": "2015-02-13T20:46:51-06:00" 
        },
        "dc": {
            "description": {
                "lang": {
                    "x-default": "Mrs Johnson's Austin Office" 
                }
            },
            "title": {
                "lang": {
                    "en-US": "Sunrise on the beach",
                    "de-DE": "Zee towels ease on zee deck-chairs" 
                }
            }
        }
    }
}
720 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ 
#4

Updated by Robin Mills over 6 years ago

  • % Done changed from 0 to 100
#5

Updated by Andreas Huggel over 6 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF