pre-commit-images

Scripts for image optimization usable as pre-commit hooks

https://github.com/boidolr/pre-commit-images

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.0%) to scientific vocabulary

Keywords

avif git-hooks image-optimization jpeg png pre-commit svg

Keywords from Contributors

wavelets sphere manifolds slepian-functions standardization
Last synced: 4 months ago · JSON representation ·

Repository

Scripts for image optimization usable as pre-commit hooks

Basic Info
  • Host: GitHub
  • Owner: boidolr
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 733 KB
Statistics
  • Stars: 9
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 33
Topics
avif git-hooks image-optimization jpeg png pre-commit svg
Created almost 4 years ago · Last pushed 5 months ago
Metadata Files
Readme License Citation Codeowners

README.md

pre-commit-images tag python Build

pre-commit

Scripts that can work as git hooks to optimize and manipulate images. These scripts can be called directly or with the provided configuration for the pre-commit framework. For details see below.

Using pre-commit-images with pre-commit

Add this to your .pre-commit-config.yaml: - repo: https://github.com/boidolr/pre-commit-images rev: v1.9.0 # Use the ref you want to point at hooks: - id: optimize-png # - id: ... For an extended example see .pre-commit-config.yaml.

Available hooks

  • optimize-avif: Compress avif images.
    • --threshold can be used to configure which size difference should be used to keep the image.
    • --quality to configure minimum quality setting (best: 100, worst: 0).
    • --effort to set the quality/speed tradeoff (slowest: 0, fastest: 10).
  • optimize-jpg: Compress jpeg images.
    • --threshold can be used to configure which size difference should be used to keep the image.
    • --quality can be used to configure quality setting for a JPG image.
  • optimize-png: Compress png images.
    • --threshold can be used to configure which size difference should be used to keep the image.
  • optimize-svg: Compress svg images.
    • --threshold can be used to configure which size difference should be used to keep the image.
  • optimize-webp: Compress webp images.
    • --threshold can be used to configure which size difference should be used to keep the image.
    • --lossless switch to lossless compression.
    • --quality can be used to configure quality setting for lossy compression or effort to spend on lossless compression.
  • resize (experimental): Resize avif, jpeg, png and webp images with fixed dimensions. Required options:
    • --width new width of images.
    • --height new height of images.

Using scripts directly

Install the package to get access to the scripts defined as command line entry points in pyproject.toml. The scripts accept the arguments given for the pre-commit hooks. Additionally they exepect to receive the file names to work on.

An example invocation could be uvx --from 'git+https://github.com/boidolr/pre-commit-images.git' optimize-avif tests/test.avif.

Available entry points are identical to the pre-commit hooks: - optimize-avif - optimize-jpg - optimize-png - optimize-svg - optimize-webp - resize

References

These hooks only work because of other projects:

Owner

  • Name: Raphael Boidol
  • Login: boidolr
  • Kind: user
  • Location: Munich, Germany
  • Company: @TNG

coding for the fun of it

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Boidol"
  given-names: "Raphael"
title: "pre-commit-images"
abstract: >-
  pre-commit-images will optimize images for size before they are checked in.
license: MIT
license-url: "https://github.com/boidolr/pre-commit-images/blob/main/LICENSE"
repository-code: "https://github.com/boidolr/pre-commit-images"
url: "https://github.com/boidolr/pre-commit-images"

GitHub Events

Total
  • Create event: 82
  • Issues event: 1
  • Release event: 6
  • Watch event: 3
  • Delete event: 74
  • Issue comment event: 8
  • Push event: 108
  • Pull request review event: 2
  • Pull request event: 146
Last Year
  • Create event: 82
  • Issues event: 1
  • Release event: 6
  • Watch event: 3
  • Delete event: 74
  • Issue comment event: 8
  • Push event: 108
  • Pull request review event: 2
  • Pull request event: 146

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 400
  • Total Committers: 5
  • Avg Commits per committer: 80.0
  • Development Distribution Score (DDS): 0.523
Past Year
  • Commits: 126
  • Committers: 2
  • Avg Commits per committer: 63.0
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
renovate[bot] 2****] 191
Raphael Boidol b****r 128
github-actions 4****] 56
github-actions g****s@g****m 17
Renovate Bot b****t@r****m 8
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 2
  • Total pull requests: 147
  • Average time to close issues: N/A
  • Average time to close pull requests: about 15 hours
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.07
  • Merged pull requests: 140
  • Bot issues: 1
  • Bot pull requests: 115
Past Year
  • Issues: 2
  • Pull requests: 134
  • Average time to close issues: N/A
  • Average time to close pull requests: about 5 hours
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.07
  • Merged pull requests: 129
  • Bot issues: 1
  • Bot pull requests: 106
Top Authors
Issue Authors
  • renovate[bot] (1)
  • DIMFLIX-OFFICIAL (1)
  • shivan-s (1)
Pull Request Authors
  • renovate[bot] (228)
  • boidolr (55)
Top Labels
Issue Labels
dependencies (1) pypi (1) pep621 (1)
Pull Request Labels
dependencies (234) github-tags (149) github-actions (91) pep621 (72) pre-commit (58) pypi (7) github-releases (6) regex (6) poetry (1)

Dependencies

.github/workflows/codeql-analysis.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/continous-integration.yml actions
  • actions/checkout v3 composite
  • boidolr/actions/python-pip-env main composite
  • boidolr/actions/run-precommit main composite
.github/workflows/create-release.yml actions
  • boidolr/actions/create-release main composite
.github/workflows/pre-commit-update.yml actions
  • actions/checkout v3 composite
  • boidolr/actions/git-push main composite
  • boidolr/actions/run-precommit main composite