Skip to content

Add PNG optimization to pre-commit #138848

Closed as not planned
Closed as not planned

Description

@StanFromIreland

It might be worth adding a pre-commit check (or workflow?) to check that images are not larger than they need to be when added or changed.

Originally posted by @zware in #138842 (comment)

From some quick research, I see https://github.com/oxipng/oxipng may be a good option.

Linked PRs

Activity

  1. added
    type-featureA feature request or enhancement
    infraCI, GitHub Actions, buildbots, Dependabot, etc.
    performancePerformance or resource usage
    on Sep 12, 2025
  2. serhiy-storchaka commented on Sep 17, 2025

    @serhiy-storchaka
    Member

    Is it supposed to run each time you make a commit in a PR? New PNG files are added once in few years, I don't think it's worth the price.

  3. StanFromIreland commented on Sep 17, 2025

    @StanFromIreland
    MemberAuthor

    On my machine, the check takes 11ms, not a noticeable difference for me.

  4. zware commented on Sep 17, 2025

    @zware
    Member

    This particular check should only run locally when a matching file is added or changed, though CI will run it always due to using --all-files. We should consider adjusting that to only run on changed files, which would also resolve the issue of CI adjusting the images we don't want to bother with without having to exclude them specifically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    infraCI, GitHub Actions, buildbots, Dependabot, etc.performancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions