oxipng icon indicating copy to clipboard operation
oxipng copied to clipboard

Feature request: Machine-readable CLI output

Open stevenpetryk opened this issue 1 year ago • 5 comments

Would be great to have a --json flag, or something similar. As it stands, if one wants to integrate Oxipng into another CLI tool (like I'm trying to do at my company), it's not really possible to easily parse the CLI output and figure out what images were optimized vs skipped.

Example output might be something like:

{
  "result": "success",
  "images": [
    { "path": "/path/to/image.png",
      "original_size": 13232,
      "optimized_size": 11323,
    },
    // ...
  ]
}

Could pipe more and more into these objects over time (like timing data, or what optimizations were applied, etc.)

stevenpetryk avatar Nov 28 '23 20:11 stevenpetryk

Seems to be conceptually similar to https://github.com/shssoichiro/oxipng/pull/501, but those "verbosities" don't seem to do for this.

TPS avatar Nov 28 '23 23:11 TPS

Are you able to use the oxipng API in your CLI tool?

andrews05 avatar Dec 21 '23 20:12 andrews05

Are you able to use the oxipng API in your CLI tool?

As in, the Rust API? If so then no, my particular use case is adding some image optimization utilities to my company's Python-based dev cli, so shelling out is a must. The alternative would be to write a rust wrapper that gives machine-readable output I guess.

stevenpetryk avatar Dec 21 '23 21:12 stevenpetryk

Hm, you may like to check this out: https://pypi.org/project/pyoxipng/

andrews05 avatar Dec 21 '23 21:12 andrews05

Thanks! I still think it'd be great for oxipng to support machine-readable output but this will likely solve my particular use case.

stevenpetryk avatar Dec 21 '23 21:12 stevenpetryk