{"id":47580572,"url":"https://github.com/Moresl/snapimg","last_synced_at":"2026-04-02T03:01:00.450Z","repository":{"id":328773010,"uuid":"1116665373","full_name":"Moresl/snapimg","owner":"Moresl","description":" 高效图片压缩工具 | Fast image compressor with PNG/JPEG/WebP/AVIF support. Local processing, no upload.","archived":false,"fork":false,"pushed_at":"2026-03-17T09:06:26.000Z","size":1805,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-17T23:50:33.593Z","etag":null,"topics":["avif","compression-tool","docker","fastapi","image-compression","image-compressor","image-optimization","image-optimizer","pngquant","privacy","react","self-hosted","shadcn-ui","tailwindcss","typescript","vite","web-app","webp"],"latest_commit_sha":null,"homepage":"https://img.biekanle.com/","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/Moresl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-15T07:53:21.000Z","updated_at":"2026-03-17T09:39:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Moresl/snapimg","commit_stats":null,"previous_names":["moresl/snapimg"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Moresl/snapimg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moresl%2Fsnapimg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moresl%2Fsnapimg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moresl%2Fsnapimg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moresl%2Fsnapimg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Moresl","download_url":"https://codeload.github.com/Moresl/snapimg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moresl%2Fsnapimg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["avif","compression-tool","docker","fastapi","image-compression","image-compressor","image-optimization","image-optimizer","pngquant","privacy","react","self-hosted","shadcn-ui","tailwindcss","typescript","vite","web-app","webp"],"created_at":"2026-03-31T18:00:38.808Z","updated_at":"2026-04-02T03:01:00.442Z","avatar_url":"https://github.com/Moresl.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003eSnapImg\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003e快速、注重隐私的在线图片压缩工具\u003c/strong\u003e\u003cbr\u003e\n  支持 PNG、JPEG、WebP、AVIF 格式，70%+ 压缩率同时保持画质\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Moresl/snapimg/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/Moresl/snapimg?style=flat-square\u0026color=yellow\" alt=\"Stars\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Moresl/snapimg/network/members\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/Moresl/snapimg?style=flat-square\" alt=\"Forks\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Moresl/snapimg/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/Moresl/snapimg?style=flat-square\" alt=\"Issues\"\u003e\u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/Moresl/snapimg?style=flat-square\u0026color=blue\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/React-19-61dafb?style=flat-square\" alt=\"React\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square\" alt=\"FastAPI\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Docker-ready-2496ed?style=flat-square\" alt=\"Docker\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://img.biekanle.com/\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/🚀 在线体验-img.biekanle.com-blue?style=for-the-badge\" alt=\"在线体验\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"README_EN.md\"\u003eEnglish\u003c/a\u003e | 中文\n\u003c/p\u003e\n\n---\n\n\u003e **为什么选择 SnapImg？** 图片完全在内存中处理，不保存到磁盘，不上传到第三方。你的图片隐私由你掌控。支持 Docker 一键部署到自己的服务器。\n\n## 相关项目\n\n本项目有两个版本，满足不同使用场景：\n\n| 版本 | 描述 | 开源地址 |\n|------|------|----------|\n| **网页版** | 当前项目，基于 React + FastAPI 的在线压缩工具 | [snapimg](https://github.com/Moresl/snapimg) |\n| **软件版** | 基于 Python + PyQt5 的桌面应用 | [ImageMinify](https://github.com/Moresl/ImageMinify) |\n\n## 功能特点\n\n- **多格式支持** - 支持 PNG、JPEG、WebP、AVIF 格式输入输出\n- **高压缩率** - PNG 使用 pngquant/imagequant 算法，压缩率可达 70%+\n- **保持质量** - 智能压缩算法，最大程度保留图片质量\n- **本地处理** - 图片在服务器内存中处理，不保存到磁盘\n- **批量压缩** - 单次最多处理 20 张图片\n- **效果对比** - 滑动对比压缩前后效果\n- **深色模式** - 支持浅色/深色主题切换\n\n## 压缩原理\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"image3.png\" width=\"60%\" alt=\"压缩原理\"\u003e\n\u003c/p\u003e\n\n## 截图\n\n![主界面](image.png)\n![压缩效果](image-1.png)\n\n## 技术栈\n\n**前端：**\n- React 19 + TypeScript\n- Tailwind CSS + Shadcn UI\n- Vite\n\n**后端：**\n- FastAPI + Python\n- Pillow + imagequant + pngquant\n- 纯内存处理，无数据库\n\n## 快速开始\n\n### Docker 部署（推荐）\n\n```bash\n# 构建镜像\ndocker build -t snapimg .\n\n# 运行容器\ndocker run -d -p 80:80 --name snapimg snapimg\n```\n\n访问 http://localhost 即可使用。\n\n### 本地开发\n\n**前端：**\n\n```bash\n# 安装依赖\nnpm install\n\n# 启动开发服务器\nnpm run dev\n```\n\n**后端：**\n\n```bash\ncd serve\n\n# 创建虚拟环境\npython -m venv venv\nsource venv/bin/activate  # Windows: venv\\Scripts\\activate\n\n# 安装依赖\npip install -r requirements.txt\n\n# 启动服务\npython main.py\n```\n\n## 项目结构\n\n```\nsnapimg/\n├── src/                    # 前端源码\n│   ├── components/         # React 组件\n│   │   ├── ui/            # Shadcn UI 组件\n│   │   ├── UploadZone.tsx\n│   │   └── ImageCompare.tsx\n│   ├── lib/               # 工具函数\n│   ├── App.tsx\n│   └── main.tsx\n├── serve/                  # 后端服务\n│   ├── app/\n│   │   ├── api/           # API 路由\n│   │   ├── core/          # 核心压缩逻辑\n│   │   └── models/        # 数据模型\n│   └── requirements.txt\n├── Dockerfile             # Docker 构建文件\n└── docker-compose.yml\n```\n\n## API 接口\n\n### POST /api/compress/single\n\n压缩单张图片。\n\n**请求：** `multipart/form-data`\n- `file`: 图片文件\n- `format`: 输出格式 (original/png/jpeg/webp/avif)\n\n**响应：**\n```json\n{\n  \"filename\": \"image.png\",\n  \"original_size\": 1024000,\n  \"compressed_size\": 307200,\n  \"compression_ratio\": 70.0,\n  \"format\": \"png\",\n  \"data\": \"data:image/png;base64,...\",\n  \"success\": true\n}\n```\n\n## 与同类工具对比\n\n| 特性 | SnapImg | TinyPNG | Squoosh |\n|------|---------|---------|---------|\n| 可自部署 | ✅ | ❌ | ❌ |\n| 隐私保护 | ✅ 纯内存处理 | ❌ 上传到第三方 | ✅ 浏览器端 |\n| 批量压缩 | ✅ 20 张 | ✅ 20 张 | ❌ 单张 |\n| AVIF 支持 | ✅ | ❌ | ✅ |\n| 效果对比 | ✅ 滑动对比 | ❌ | ✅ |\n| Docker 部署 | ✅ 一键部署 | ❌ | ❌ |\n| 开源免费 | ✅ MIT | ❌ 付费 API | ✅ |\n\n## 贡献\n\n欢迎贡献代码！请查看 [CONTRIBUTING.md](CONTRIBUTING.md) 了解详情。\n\n我们提供了标准化的 Issue 模板，你可以方便地：\n- 🐛 [报告 Bug](https://github.com/Moresl/snapimg/issues/new?template=bug_report.yml)\n- ✨ [建议功能](https://github.com/Moresl/snapimg/issues/new?template=feature_request.yml)\n- ❓ [提出问题](https://github.com/Moresl/snapimg/issues/new?template=question.yml)\n\n## 许可证\n\n[MIT License](LICENSE)\n\n## Star History\n\n如果觉得有用，请给个 ⭐ 支持一下！\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Moresl/snapimg\u0026type=date)](https://www.star-history.com/#Moresl/snapimg\u0026type=date)\n","funding_links":[],"categories":["Platforms"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMoresl%2Fsnapimg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMoresl%2Fsnapimg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMoresl%2Fsnapimg/lists"}