{"id":27320323,"url":"https://github.com/ghkmmm/shrinkpng","last_synced_at":"2025-04-12T09:46:43.609Z","repository":{"id":57689166,"uuid":"494338808","full_name":"GHkmmm/shrinkpng","owner":"GHkmmm","description":"Compress the image files obtained by the front end","archived":false,"fork":false,"pushed_at":"2023-01-13T09:53:30.000Z","size":138,"stargazers_count":18,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T02:01:54.279Z","etag":null,"topics":["image-compression","react","tinypng","typescript","vuejs"],"latest_commit_sha":null,"homepage":"http://compress.tracex.top","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GHkmmm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-20T05:55:43.000Z","updated_at":"2024-11-23T04:00:40.000Z","dependencies_parsed_at":"2023-02-09T15:16:46.903Z","dependency_job_id":null,"html_url":"https://github.com/GHkmmm/shrinkpng","commit_stats":null,"previous_names":["ghkmmm/shrinkjs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GHkmmm%2Fshrinkpng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GHkmmm%2Fshrinkpng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GHkmmm%2Fshrinkpng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GHkmmm%2Fshrinkpng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GHkmmm","download_url":"https://codeload.github.com/GHkmmm/shrinkpng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248550629,"owners_count":21122930,"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":["image-compression","react","tinypng","typescript","vuejs"],"created_at":"2025-04-12T09:46:42.921Z","updated_at":"2025-04-12T09:46:43.595Z","avatar_url":"https://github.com/GHkmmm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n * @Author: Tracer\n * @Date: 2022-06-26 21:50:31\n * @LastEditors: otis\n * @LastEditTime: 2023-01-08 16:34:23\n * @FilePath: /shrinkpng/README.md\n--\u003e\n\u003ch1 align=\"center\"\u003eshrinkpng\u003c/h1\u003e\n\n\u003cp align=\"center\" style=\"color:#0066cc;font-size:18px\"\u003eCompress the image files obtained by the front end\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  💻 \u003ca href=\"http://compress.tracex.top\" target=\"_blank\"\u003eOfficial website\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  🌍 \u003ca href=\"https://github.com/GHkmmm/shrinkpng\" target=\"_blank\"\u003eGithub\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  🚀 \u003ca href=\"https://www.npmjs.com/package/shrinkpng\" target=\"_blank\"\u003eNpm\u003c/a\u003e\n\u003c/p\u003e\n\n使用[UPNG.js](https://github.com/photopea/UPNG.js)对 PNG 文件进行有损缩小，类似于[TinyPNG](https://tinypng.com/)和其他工具。\n\n## 安装\n\n打开终端运行下列命令：\n\n```\nnpm install shrinkpng\n```\n\n或\n\n```\nyarn add shrinkpng\n```\n\n## 开始使用\n\n请先[下载]()本插件\n\n然后在你的代码中引入 shrinkpng\n\n```js\nimport { shrinkImage } from \"shrinkpng\";\n\n...\nconst _file = await shrinkImage(file, {\n  quality: 80\n});\n```\n\n#### Vue 文件示例\n\n代码示例\n\n```vue\n\u003ctemplate\u003e\n\t\u003cdiv id=\"app\"\u003e\n\t\t\u003cinput\n\t\t\ttype=\"file\"\n\t\t\tclass=\"file\"\n\t\t\tid=\"imgUpFile\"\n\t\t\tstyle=\"position: absolute; left: 0; top: 0; width: 100%; height: 100%\"\n\t\t/\u003e\n\t\u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport { shrinkImage } from \"shrinkpng\";\n\nexport default {\n  name: \"App\",\n  mounted() {\n    document.getElementById(\"imgUpFile\").addEventListener(\"change\", (e) =\u003e {\n      const file = e.target.files[0];\n      const _file = await shrinkImage(file, {\n        quality: 80\n      }); // compress file\n    });\n  },\n};\n\u003c/script\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghkmmm%2Fshrinkpng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghkmmm%2Fshrinkpng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghkmmm%2Fshrinkpng/lists"}