{"id":30154247,"url":"https://github.com/ShreyashThorat-17/ngx-image-compression","last_synced_at":"2025-08-11T12:07:18.183Z","repository":{"id":308512255,"uuid":"1033012446","full_name":"ShreyashThorat-17/ngx-image-compression","owner":"ShreyashThorat-17","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-06T09:22:55.000Z","size":12398,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-06T11:20:42.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/ShreyashThorat-17.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,"zenodo":null}},"created_at":"2025-08-06T07:04:51.000Z","updated_at":"2025-08-06T09:22:59.000Z","dependencies_parsed_at":"2025-08-06T11:32:34.309Z","dependency_job_id":null,"html_url":"https://github.com/ShreyashThorat-17/ngx-image-compression","commit_stats":null,"previous_names":["shreyashthorat-17/ngx-image-compression"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ShreyashThorat-17/ngx-image-compression","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyashThorat-17%2Fngx-image-compression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyashThorat-17%2Fngx-image-compression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyashThorat-17%2Fngx-image-compression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyashThorat-17%2Fngx-image-compression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShreyashThorat-17","download_url":"https://codeload.github.com/ShreyashThorat-17/ngx-image-compression/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShreyashThorat-17%2Fngx-image-compression/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269884143,"owners_count":24490366,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"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":[],"created_at":"2025-08-11T12:02:03.037Z","updated_at":"2025-08-11T12:07:18.157Z","avatar_url":"https://github.com/ShreyashThorat-17.png","language":"TypeScript","funding_links":[],"categories":["Third Party Components"],"sub_categories":["Images"],"readme":"# 📦 ngx-image-compression\n\nA **lightweight image compression and conversion library** for Angular. Ideal for optimizing large images (like 10MB+) **before uploading to S3 or a server**. Supports format conversion (e.g., JPG → WebP), resizing, quality tuning, and base64 or Blob output.\n\n---\n\n## 🚀 Features\n\n- 🔧 Compress images using canvas\n- 📐 Resize to desired dimensions\n- 🎯 Convert to different formats (`webp`, `jpeg`, `png`)\n- 🧠 Works with File, Blob, or base64 outputs\n- 📦 Lightweight and framework-friendly\n- 🟢 Built for Angular 16+ standalone architecture\n\n---\n\n## 📥 Installation\n\n```\nnpm install ngx-image-lite\n```\n\n---\n\n## 🛠️ Usage\n\n```\nimport { compressImage } from 'ngx-image-lite';\n\nconst result = await compressImage(file, {\n  maxWidth: 800,\n  maxHeight: 800,\n  quality: 0.7,\n  format: 'webp',         // optional: 'jpeg', 'png', or 'webp'\n  returnType: 'file',     // 'file' | 'base64' | 'blob'\n  fileName: 'output'      // only for returnType: 'file'\n});\n```\n\n---\n\n## 📘 Parameters\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `maxWidth` | `number` | `800` | Max width of output image |\n| `maxHeight` | `number` | `800` | Max height of output image |\n| `quality` | `number` | `0.7` | Compression quality (0 to 1) |\n| `format` | `string` | `'webp'` | Output format: 'webp', 'jpeg', 'png' |\n| `returnType` | `string` | `'file'` | 'file', 'base64', or 'blob' |\n| `fileName` | `string` | `'output'` | File name (if returnType is file) |\n\n---\n\n## 📦 Returns\n\n- If `returnType = 'file'` → returns a `File` object\n- If `returnType = 'blob'` → returns a `Blob`\n- If `returnType = 'base64'` → returns a `string` (base64)\n\n---\n\n## 🖼️ Example with Angular\n\n```\nconst result = await compressImage(file, {\n  maxWidth: 1024,\n  maxHeight: 1024,\n  quality: 0.6,\n  format: 'jpeg',\n  returnType: 'base64'\n});\nthis.previewUrl = result; // Display in \n```\n\n---\n\n## 📌 Use Cases\n\n- Upload large images to AWS S3 with smaller payload\n- Resize user-uploaded profile or gallery images\n- Convert formats (e.g., PNG → WebP) for optimized delivery\n- Reduce load on backend image processing\n\n---\n\n## 🔖 License\n\n[MIT](LICENSE)\n\n---\n\n## 🔍 Keywords\n\nangular, image compression, image conversion, webp, optimize image, resize, compress, image, s3 upload, ngx, frontend compression\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShreyashThorat-17%2Fngx-image-compression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FShreyashThorat-17%2Fngx-image-compression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShreyashThorat-17%2Fngx-image-compression/lists"}