lucach / meta-png

JavaScript library to store and retrieve metadata in PNG files
27 stars 2 forks source link

Retrieve all metadata #8

Open samjco opened 3 weeks ago

samjco commented 3 weeks ago

Is it possible to retrieve what meta data is already in a png file? for example:

 {
  "pHYs": { 
    "x": 30000,
    "y": 30000,
    "units": RESOLUTION_UNITS.INCHES
  },
  "tEXt": {
    "Title":            "Short (one line) title or caption for image",
    "Author":           "Name of image's creator",
    "Description":      "Description of image (possibly long)",
    "Copyright":        "Copyright notice",
    "Software":         "Software used to create the image",
    "Disclaimer":       "Legal disclaimer",
    "Warning":          "Warning of nature of content",
    "Source":           "Device used to create the image",
    "Comment":          "Miscellaneous comment"
  }
}
lucach commented 2 weeks ago

Hi @samjco,

It's currently not implemented, but it would definitely be technically feasible. (I don't have the bandwidth to do it myself now, but feel free to open a PR if you want to give it a try.)

At least for tEXt chunks, it shouldn't be hard to mimic the current loop in getMetadata to extract all the keys.