Skip to content

Optimize PNGs #71648

Closed
Closed

Description

@scop
mannequin
BPO 27461
Nosy @vstinner, @scop
Files
  • pngs.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2016-07-07.12:29:34.334>
    labels = ['type-feature', 'docs']
    title = 'Optimize PNGs'
    updated_at = <Date 2018-06-16.15:37:41.531>
    user = 'https://github.com/scop'

    bugs.python.org fields:

    activity = <Date 2018-06-16.15:37:41.531>
    actor = 'willingc'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2016-07-07.12:29:34.334>
    creator = 'scop'
    dependencies = []
    files = ['43896']
    hgrepos = []
    issue_num = 27461
    keywords = ['patch']
    message_count = 5.0
    messages = ['269929', '269930', '269931', '269932', '271377']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'scop', 'docs@python']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue27461'
    versions = []

    Linked PRs

    Activity

    1. scop commented on Jul 7, 2016

      scopmannequin
      MannequinAuthor

      Running PNGs through zopflipng makes them smaller, with no drawbacks. This patch was done with zopflipng version 1.0.1 with the -m option, and decreases the in-tree total size size of all *.png by almost 100KiB.

      $ find -name "*.png" | xargs du -bc | tail -n 1  # before
      291101	total
      
      $ find -name "*.png" | xargs du -bc | tail -n 1  # after
      194639	total
    2. added
      docsDocumentation in the Doc dir
      type-featureA feature request or enhancement
      on Jul 7, 2016
    3. vstinner commented on Jul 7, 2016

      @vstinner
      Member

      Hi, The idea is interesting, but IMO it would be more efficient to contribute to Sphinx, so all documentations will benefit of smallest pictures. There is a similar tool for JPEG. Victor

    4. scop commented on Jul 7, 2016

      scopmannequin
      MannequinAuthor

      Sure, I plan to suggest this to sphinx as well.

      One corresponding tool for JPEGs is jpegoptim and its --strip-all option, but there is only ./Mac/BuildScript/resources/background.jpg in the cpython source tree (which despite of the .jpg extension appears to be a PNG file so I don't want to touch that stuff), plus ./Lib/test/imghdrdata/python.jpg which isn't worth a patch alone :)

    5. vstinner commented on Jul 7, 2016

      @vstinner
      Member

      there is only ./Mac/BuildScript/resources/background.jpg in the cpython source tree (which despite of the .jpg extension appears to be a PNG file so I don't want to touch that stuff)

      Oh funny, you're right: it's a PNG file :-)

    6. scop commented on Jul 26, 2016

      scopmannequin
      MannequinAuthor

      Updated patch against tip.

      Before: 289426 total
      After: 194638 total

    7. transferred this issue fromon Apr 10, 2022
    8. StanFromIreland commented on Sep 12, 2025

      @StanFromIreland
      Member

      This was already done in #74845

      I will check if doing it again has any benefit

    9. added a commit that references this issue on Sep 12, 2025
    10. added a commit that references this issue on Sep 12, 2025
    11. added 2 commits that reference this issue on Sep 12, 2025
    12. StanFromIreland commented on Sep 12, 2025

      @StanFromIreland
      Member

      For reference, adding a pre-commit hook to automatically optimize is tracked in #138848

    13. added a commit that references this issue on Sep 14, 2025
    14. added a commit that references this issue on Oct 7, 2025
    15. kerajbereta-code commented on Sep 16, 2026

      @kerajbereta-code
    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

      docsDocumentation in the Doc dirtype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions