{"id":16977101,"url":"https://github.com/lenni009/simple-image-compressor","last_synced_at":"2026-04-17T13:31:47.656Z","repository":{"id":222166281,"uuid":"756425863","full_name":"Lenni009/simple-image-compressor","owner":"Lenni009","description":"Simple frontend JS library to compress images","archived":false,"fork":false,"pushed_at":"2026-04-06T18:46:27.000Z","size":1829,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-06T20:27:32.608Z","etag":null,"topics":["compression","hacktoberfest","image-processing","javascript","library","typescript"],"latest_commit_sha":null,"homepage":"https://lenni009.github.io/simple-image-compressor/","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/Lenni009.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-12T16:33:58.000Z","updated_at":"2025-11-11T10:53:10.000Z","dependencies_parsed_at":"2024-03-02T11:37:19.517Z","dependency_job_id":"779e0a26-8b2c-4b93-916c-d9afe1d045f0","html_url":"https://github.com/Lenni009/simple-image-compressor","commit_stats":null,"previous_names":["lenni009/simple-image-compressor"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/Lenni009/simple-image-compressor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lenni009%2Fsimple-image-compressor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lenni009%2Fsimple-image-compressor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lenni009%2Fsimple-image-compressor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lenni009%2Fsimple-image-compressor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lenni009","download_url":"https://codeload.github.com/Lenni009/simple-image-compressor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lenni009%2Fsimple-image-compressor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31931267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T12:37:54.787Z","status":"ssl_error","status_checked_at":"2026-04-17T12:37:25.095Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["compression","hacktoberfest","image-processing","javascript","library","typescript"],"created_at":"2024-10-14T01:28:04.028Z","updated_at":"2026-04-17T13:31:47.639Z","avatar_url":"https://github.com/Lenni009.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Image Compressor\n\nThis is a client-side file compression library using web workers.\n\nGreatly inspired by https://github.com/WangYuLue/image-conversion\n\n## Installation\n\n### NPM\n\n```sh\nnpm i simple-image-compressor\n```\n\n### CDN\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/simple-image-compressor@1.8.2/dist/simple-image-compressor-min.js\"\u003e\u003c/script\u003e\n```\n\n## Main function\n\n`compressImage()`\n\n## Parameters\n\n1. file: File\n2. config: `{ type: 'image/jpeg' | 'image/webp' = 'image/jpeg', quality: number = 0.92 }`\n\n## Return\n\n`Promise\u003cBlob\u003e`\n\n## Usage\n\n### NPM\n\n```js\nimport { compressImage } from 'simple-image-compressor';\n\nasync function compressFile(file) {\n  const options = {\n    quality: 0.9,\n    type: 'image/jpeg',\n  };\n  const res = await compressImage(file, options);\n  return new File([res], 'new filename.jpg', { type: 'image/jpeg' });\n}\n\nconst file = document.getElementById('file-input')?.files?.[0];\n\nconst compressedImage = await compressFile(file);\n\n// upload to server, etc.\n```\n\n### CDN\n\n```html\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cscript src=\"https://cdn.jsdelivr.net/npm/simple-image-compressor@1.8.1/dist/simple-image-compressor-min.js\"\u003e\u003c/script\u003e\n    \u003cscript\u003e\n      window.onload = () =\u003e {\n        const fileInput = document.getElementById('file-input');\n        fileInput.addEventListener('change', async () =\u003e {\n          const file = fileInput.files[0];\n          const options = {\n            quality: 0.9,\n            type: imageCompressor.imageTypes.WEBP,\n          };\n          const compressedImage = await imageCompressor.compressImage(file, options);\n          // do something with the compressed image\n        });\n      };\n    \u003c/script\u003e\n  \u003c/head\u003e\n\n  \u003cbody\u003e\n    \u003cinput\n      id=\"file-input\"\n      type=\"file\"\n    /\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Additional Export\n\n```js\nimport { imageTypes, compressImage } from 'simple-image-compressor';\n```\n\n`imageTypes` is an object containing the two expected values for `config.type`:\n\n```js\nconst imageTypes = {\n  WEBP: 'image/webp',\n  JPEG: 'image/jpeg',\n};\n```\n\n## How it works\n\nFile -\u003e imageBitMap -\u003e Canvas -\u003e Blob\n\n\"ImageBitMap -\u003e Canvas -\u003e Blob\" happens in a web worker, allowing for parallel processing.\n\n## Similar Packages\n\n- [browser-image-compression](https://www.npmjs.com/package/browser-image-compression)\n- [image-conversion](https://www.npmjs.com/package/image-conversion)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenni009%2Fsimple-image-compressor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flenni009%2Fsimple-image-compressor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenni009%2Fsimple-image-compressor/lists"}