{"id":20555838,"url":"https://github.com/mintimate/githookpng2webp","last_synced_at":"2025-03-06T06:41:31.781Z","repository":{"id":261908059,"uuid":"885690287","full_name":"Mintimate/GitHookPng2WebP","owner":"Mintimate","description":"Utilize Python and Git Hooks to automatically convert images to WebP format and add watermarks during each push to the repository.","archived":false,"fork":false,"pushed_at":"2024-11-09T06:16:53.000Z","size":22,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T18:03:10.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mintimate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-09T06:03:22.000Z","updated_at":"2024-12-12T10:33:14.000Z","dependencies_parsed_at":"2024-11-09T13:51:42.906Z","dependency_job_id":null,"html_url":"https://github.com/Mintimate/GitHookPng2WebP","commit_stats":null,"previous_names":["mintimate/githookpng2webp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintimate%2FGitHookPng2WebP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintimate%2FGitHookPng2WebP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintimate%2FGitHookPng2WebP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintimate%2FGitHookPng2WebP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mintimate","download_url":"https://codeload.github.com/Mintimate/GitHookPng2WebP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242163849,"owners_count":20082224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T03:21:04.128Z","updated_at":"2025-03-06T06:41:31.767Z","avatar_url":"https://github.com/Mintimate.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Guide\n\n文件结构:\n- image2WebpForGit.py: 用于将图片转换为webp格式的脚本，并且支持将图片添加水印。\n- post-receive: 用于替换 Git Hook 内的 post-receive 脚本，用于差异化 commit 内容，调用 image2WebpForGit.py 脚本。\n\n## image2WebpForGit.py\n\n需要安装的库：\n```bash\npip install pillow\n```\n\n使用方法：\n1. 将 image2WebpForGit.py 放置在项目根目录下。\n2. 终端执行 `python3 -s 「原始文件地址」' -t 「目标文件地址」 image2WebpForGit.py` 即可将项目中的图片转换为 webp 格式。\n\n可选参数：\n- -r: 替换原始文件，传入参数，会自动删除原始文件。\n- -w: 添加水印，需要传入水印图片地址。\n\n## post-receive\n需要将 post-receive 文件放置在项目的 hooks/ 目录下，替换原有的 post-receive 文件。并且确保 post-receive 文件有执行权限。\n\n需要修改文件内部的变量执行为自己的服务器:\n\n```yaml\n# 定义图片文件后缀（需要转换为 WebP 格式的文件后缀）\nimage_extensions=(\".png\" \".jpg\" \".jpeg\" \".PNG\")\n\n# 网站目标目录\nWEB_DIR=\"/www/webRoot/imagehost.mintimate.cn\"\n# 工作空间临时检录目录\nWORK_SPACE_DIR=\"/home/git/mySpace/imagehost.mintimate.cn\"\n# 定义需要跳过的文件前缀\nskip_prefixes=(\"emoticon\" \"emoji\")\n# Python Fle Path\nPYTHON_MAIN=\"/home/git/PythonTool\"\n# 定义输出目录\nOUTPUT_DIR=\"/home/git/GitHookLogs\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmintimate%2Fgithookpng2webp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmintimate%2Fgithookpng2webp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmintimate%2Fgithookpng2webp/lists"}