Extracting properties from JSON output

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
salttrail
Posts: 2
Joined: 2019-03-27T02:27:26-07:00
Authentication code: 1152

Extracting properties from JSON output

Post by salttrail »

Hello,

Is it possible to pick specific properties once image is converted to json output instead of getting everything?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Extracting properties from JSON output

Post by snibgo »

When IM writes to "json:", it writes all the properties. You can then use an external program such as grep to filter the results, eg:

Code: Select all

magick toes.png -format %wx%h json: |grep gamma

    "gamma": 0.45455,
      "png:gAMA": "gamma=0.45454544 (See Gamma, above)",
snibgo's IM pages: im.snibgo.com
salttrail
Posts: 2
Joined: 2019-03-27T02:27:26-07:00
Authentication code: 1152

Re: Extracting properties from JSON output

Post by salttrail »

Thanks,

It will not work in my case since we are expecting and parsing actual json object
Post Reply