Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Machine-readable CLI output #583

Open
stevenpetryk opened this issue Nov 28, 2023 · 5 comments
Open

Feature request: Machine-readable CLI output #583

stevenpetryk opened this issue Nov 28, 2023 · 5 comments
Labels
T-Feature Requests for a new feature to be added

Comments

@stevenpetryk
Copy link

stevenpetryk commented Nov 28, 2023

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.)

@TPS
Copy link

TPS commented Nov 28, 2023

Seems to be conceptually similar to #501, but those "verbosities" don't seem to do for this.

@andrews05 andrews05 added the T-Feature Requests for a new feature to be added label Nov 29, 2023
@andrews05
Copy link
Collaborator

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

@stevenpetryk
Copy link
Author

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.

@andrews05
Copy link
Collaborator

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

@stevenpetryk
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Feature Requests for a new feature to be added
Projects
None yet
Development

No branches or pull requests

3 participants