{"_id":"@100jm/image-resizer","_rev":"8-990896594bcd652cbae2c6ab04c45a7c","name":"@100jm/image-resizer","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.0":{"name":"@100jm/image-resizer","version":"1.0.0","keywords":["resize","image","typescript","photo","thumbnail","resizer"],"author":{"name":"100jm"},"license":"MIT","_id":"@100jm/image-resizer@1.0.0","maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"homepage":"https://github.com/100JM/image-resizer#readme","bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"dist":{"shasum":"2ced6a3999fd6e5c861ca672f37d2ebd201b8a41","tarball":"https://registry.npmjs.org/@100jm/image-resizer/-/image-resizer-1.0.0.tgz","fileCount":12,"integrity":"sha512-GqHWvDi6gu4dV1sVSeEFWz6yYYMrLJ0VW07D4Yr5YFwgqoAqpjzdwov81vjbhIwf6TVWkWuwFvDnQXd+KNHveQ==","signatures":[{"sig":"MEUCIGkqCHpCoZ1fPfP1wwUgWYa36BfdfqD/w+DeAz6v+1r3AiEAiX8cpjl4+54fXehun5yZDcx9td9DUh/MdmgAKDpIJzU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24142},"main":"dist/cjs/index.js","types":"dist/mjs/index.d.ts","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"gitHead":"e626755c603f73bb8fdee9ad8d5ba859fe33f771","scripts":{"dev":"tsc --watch","test":"jest","build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node -e \"require('fs').writeFileSync('dist/mjs/package.json', JSON.stringify({type: 'module'})); require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type: 'commonjs'}));\"","clean":"rm -rf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"100jm","email":"bjm.931026@gmail.com"},"repository":{"url":"git+https://github.com/100JM/image-resizer.git","type":"git"},"_npmVersion":"10.8.2","description":"resize image function","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.0.4","jsdom":"^26.1.0","canvas":"^3.1.2","rimraf":"^6.0.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^24.0.13","jest-environment-jsdom":"^30.0.4"},"_npmOperationalInternal":{"tmp":"tmp/image-resizer_1.0.0_1752733120397_0.3137489592014442","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@100jm/image-resizer","version":"1.0.1","keywords":["resize","image","typescript","photo","thumbnail","resizer"],"author":{"name":"100jm"},"license":"MIT","_id":"@100jm/image-resizer@1.0.1","maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"homepage":"https://github.com/100JM/image-resizer#readme","bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"dist":{"shasum":"caaf3da98bf1589c386c2a8d89a78dbfc85fc147","tarball":"https://registry.npmjs.org/@100jm/image-resizer/-/image-resizer-1.0.1.tgz","fileCount":12,"integrity":"sha512-27CMdctYCmxPoim1z4sNWOb+TD/qzyGxmFo+Qlz82tqunpLkLXQ/oaxXSPkJJqB2Hkl6A1dooNhONLMp2Ez/Yg==","signatures":[{"sig":"MEYCIQCNwOEU0X+tj8VPrZAxSoTzETfArskqXoT2D7xXXWqtsgIhAJ02lzarmSbcBDOwRSjuT9mDl+qx7T24S4v/Yg43XSVq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24156},"main":"dist/cjs/index.js","types":"dist/mjs/index.d.ts","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"gitHead":"d3ef113b64135975350115a3599bc4460c370140","scripts":{"dev":"tsc --watch","test":"jest","build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node -e \"require('fs').writeFileSync('dist/mjs/package.json', JSON.stringify({type: 'module'})); require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type: 'commonjs'}));\"","clean":"rm -rf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"100jm","email":"bjm.931026@gmail.com"},"repository":{"url":"git+https://github.com/100JM/image-resizer.git","type":"git"},"_npmVersion":"10.8.2","description":"resize image function","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.0.4","jsdom":"^26.1.0","canvas":"^3.1.2","rimraf":"^6.0.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^24.0.13","jest-environment-jsdom":"^30.0.4"},"_npmOperationalInternal":{"tmp":"tmp/image-resizer_1.0.1_1752734258582_0.620622983384548","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@100jm/image-resizer","version":"1.0.2","keywords":["resize","image","typescript","photo","thumbnail","resizer"],"author":{"name":"100jm"},"license":"MIT","_id":"@100jm/image-resizer@1.0.2","maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"homepage":"https://github.com/100JM/image-resizer#readme","bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"dist":{"shasum":"1bb00803cccf6a7d1b17c2ba29eae9e2080045b5","tarball":"https://registry.npmjs.org/@100jm/image-resizer/-/image-resizer-1.0.2.tgz","fileCount":12,"integrity":"sha512-pzw4UeOyvyvPokYYFLBxzvt5235KFnck2yztyQALZZzLCQepuZGg1Dh/jHRV0ysNDKjq1bRWYAM2vemOvthEkg==","signatures":[{"sig":"MEUCIQDxQTtvw337qpsjL2DT5CeYvK8P2dUhLDELGK9qVHWghwIgYFVBT1nFmuum30C3MyFmgP92rU7K+1D4teTJntGUfbY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24191},"main":"dist/cjs/index.js","types":"dist/mjs/index.d.ts","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"gitHead":"71e80a32fc8b218a70019213534756612095170f","scripts":{"dev":"tsc --watch","test":"jest","build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node -e \"require('fs').writeFileSync('dist/mjs/package.json', JSON.stringify({type: 'module'})); require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type: 'commonjs'}));\"","clean":"rm -rf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"100jm","email":"bjm.931026@gmail.com"},"repository":{"url":"git+https://github.com/100JM/image-resizer.git","type":"git"},"_npmVersion":"10.8.2","description":"resize image function","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.0.4","jsdom":"^26.1.0","canvas":"^3.1.2","rimraf":"^6.0.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^24.0.13","jest-environment-jsdom":"^30.0.4"},"_npmOperationalInternal":{"tmp":"tmp/image-resizer_1.0.2_1752734992673_0.31884055690648805","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@100jm/image-resizer","version":"1.0.3","keywords":["resize","image","typescript","photo","thumbnail","resizer"],"author":{"name":"100jm"},"license":"MIT","_id":"@100jm/image-resizer@1.0.3","maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"homepage":"https://github.com/100JM/image-resizer#readme","bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"dist":{"shasum":"bdda16e88a768e0f2409f58c10d1c0c5122d47b4","tarball":"https://registry.npmjs.org/@100jm/image-resizer/-/image-resizer-1.0.3.tgz","fileCount":12,"integrity":"sha512-rMp8Gv1UeEgOQXHX6g9vvq6lUCkWn5vjM/gOLvPsF7zSwdcCWpqoDENU0UFiokZggn8DdUQ8bxFv90E3cC2yQQ==","signatures":[{"sig":"MEUCIEzJF3HxWcNgYtcQTnzWXfJ1OIuB2dtxZBdTydQxIvaTAiEAhmoCQ6W8uIjZ8KoaeWSs0qTlZZzdgcZqdnjw9shuKuE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26441},"main":"dist/cjs/index.js","types":"dist/mjs/index.d.ts","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"gitHead":"2ebc7e9db1d2cc2bdf21484d0bd92f05c708d76b","scripts":{"dev":"tsc --watch","test":"jest","build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node -e \"require('fs').writeFileSync('dist/mjs/package.json', JSON.stringify({type: 'module'})); require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type: 'commonjs'}));\"","clean":"rm -rf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"100jm","email":"bjm.931026@gmail.com"},"repository":{"url":"git+https://github.com/100JM/image-resizer.git","type":"git"},"_npmVersion":"10.8.2","description":"resize image function","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.0.4","jsdom":"^26.1.0","canvas":"^3.1.2","rimraf":"^6.0.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^24.0.13","jest-environment-jsdom":"^30.0.4"},"_npmOperationalInternal":{"tmp":"tmp/image-resizer_1.0.3_1752738823971_0.027260362748985356","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@100jm/image-resizer","version":"1.0.4","keywords":["resize","image","typescript","photo","thumbnail","resizer"],"author":{"name":"100jm"},"license":"MIT","_id":"@100jm/image-resizer@1.0.4","maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"homepage":"https://github.com/100JM/image-resizer#readme","bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"dist":{"shasum":"de4494cf7003762826299500bffe535053996798","tarball":"https://registry.npmjs.org/@100jm/image-resizer/-/image-resizer-1.0.4.tgz","fileCount":16,"integrity":"sha512-8Hre2a7mNCgMawIqL8lfoCiRmE5RrAFvtRa9OkuOU7KQrEQDN2hhqsFMuRW/9K+XQTZdOPBpQuABVSlFKpLLnw==","signatures":[{"sig":"MEUCIQDE24ANxXNhyUx20WHFURU7G/BsiPU/8C4tNriYVRjgeQIgGWEZZbkj1Ls7EcrM28h2gQ0LSH0wdjxCbOz7T+0kdfk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27741},"main":"dist/cjs/index.js","types":"dist/mjs/index.d.ts","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"gitHead":"927f905427f2478e403beafd69148f1d9e4bda68","scripts":{"dev":"tsc --watch","test":"jest","build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node -e \"require('fs').writeFileSync('dist/mjs/package.json', JSON.stringify({type: 'module'})); require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type: 'commonjs'}));\"","clean":"rm -rf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"100jm","email":"bjm.931026@gmail.com"},"repository":{"url":"git+https://github.com/100JM/image-resizer.git","type":"git"},"_npmVersion":"10.8.2","description":"resize image function","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.0.4","jsdom":"^26.1.0","canvas":"^3.1.2","rimraf":"^6.0.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^24.0.13","jest-environment-jsdom":"^30.0.4"},"_npmOperationalInternal":{"tmp":"tmp/image-resizer_1.0.4_1752741665460_0.5248860898155512","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@100jm/image-resizer","version":"1.0.5","keywords":["resize","image","typescript","photo","thumbnail","resizer"],"author":{"name":"100jm"},"license":"MIT","_id":"@100jm/image-resizer@1.0.5","maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"homepage":"https://github.com/100JM/image-resizer#readme","bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"dist":{"shasum":"0ac35d1feab597d89b633533b4a8556c548d6b55","tarball":"https://registry.npmjs.org/@100jm/image-resizer/-/image-resizer-1.0.5.tgz","fileCount":16,"integrity":"sha512-T/HT2w7dhfpeMKezzzjlHMeV07TpbGpBkq0oiQH//6VRHtXZYAN67GZY/ZHh1C0d0Q8261YzImcpyyPX0d3RHw==","signatures":[{"sig":"MEUCIQD7N5WEWmeWjAQXpkOG5ETQ9hON5FIuWwPqWDeomfzeOwIgOzACScb1i0fX+cwzBqS3q/CudBY+KG9c2Z73YhEk28E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27287},"main":"dist/cjs/index.js","types":"dist/mjs/index.d.ts","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"gitHead":"81736c87bdd1d4899a20361c74d293131114daca","scripts":{"dev":"tsc --watch","test":"jest","build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node -e \"require('fs').writeFileSync('dist/mjs/package.json', JSON.stringify({type: 'module'})); require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type: 'commonjs'}));\"","clean":"rm -rf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"100jm","email":"bjm.931026@gmail.com"},"repository":{"url":"git+https://github.com/100JM/image-resizer.git","type":"git"},"_npmVersion":"10.8.2","description":"resize image function","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.0.4","jsdom":"^26.1.0","canvas":"^3.1.2","rimraf":"^6.0.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^24.0.13","jest-environment-jsdom":"^30.0.4"},"_npmOperationalInternal":{"tmp":"tmp/image-resizer_1.0.5_1752742798824_0.16077290480399675","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@100jm/image-resizer","version":"1.0.6","keywords":["resize","image","typescript","photo","thumbnail","resizer"],"author":{"name":"100jm"},"license":"MIT","_id":"@100jm/image-resizer@1.0.6","maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"homepage":"https://github.com/100JM/image-resizer#readme","bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"dist":{"shasum":"03cf3602e6110951b34ffb29a06404a72152bd33","tarball":"https://registry.npmjs.org/@100jm/image-resizer/-/image-resizer-1.0.6.tgz","fileCount":16,"integrity":"sha512-QI6yXsmmRszMJ2oLO0YSUk/W5Cn8lhV+iSh9K0LR7Wnz7y1egsCDCYcBiKl+mYLSC9sc2KE4kxGAPfJ48pNQlg==","signatures":[{"sig":"MEQCICogP4kh3FSuqCUeJH+KiQHv9Rscc4hGGPHzdkDI7GYWAiBh6uI7zR5W3rI3Gx+zdOxCazHk77oNIF8PTS8mMwjHiQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27360},"main":"dist/cjs/index.js","types":"dist/mjs/index.d.ts","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"gitHead":"f941d6f9c00237eff14f5756a96c42e2ca4a0cfd","scripts":{"dev":"tsc --watch","test":"jest","build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node -e \"require('fs').writeFileSync('dist/mjs/package.json', JSON.stringify({type: 'module'})); require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type: 'commonjs'}));\"","clean":"rm -rf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"100jm","email":"bjm.931026@gmail.com"},"repository":{"url":"git+https://github.com/100JM/image-resizer.git","type":"git"},"_npmVersion":"10.8.2","description":"resize image function","directories":{},"_nodeVersion":"20.17.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.0.4","jsdom":"^26.1.0","canvas":"^3.1.2","rimraf":"^6.0.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^24.0.13","jest-environment-jsdom":"^30.0.4"},"_npmOperationalInternal":{"tmp":"tmp/image-resizer_1.0.6_1752803421257_0.33249183772554614","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@100jm/image-resizer","publishConfig":{"access":"public"},"version":"1.0.7","description":"resize image function","main":"dist/cjs/index.js","module":"dist/mjs/index.js","types":"dist/mjs/index.d.ts","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"scripts":{"test":"jest","build":"rimraf dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node -e \"require('fs').writeFileSync('dist/mjs/package.json', JSON.stringify({type: 'module'})); require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type: 'commonjs'}));\"","dev":"tsc --watch","prepublishOnly":"npm run build","clean":"rm -rf dist"},"repository":{"type":"git","url":"git+https://github.com/100JM/image-resizer.git"},"keywords":["resize","image","typescript","photo","thumbnail","resizer"],"author":{"name":"100jm"},"license":"MIT","bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"homepage":"https://github.com/100JM/image-resizer#readme","devDependencies":{"@types/jest":"^30.0.0","@types/node":"^24.0.13","jest":"^30.0.4","jest-environment-jsdom":"^30.0.4","jest-puppeteer":"^11.0.0","jsdom":"^26.1.0","rimraf":"^6.0.1","ts-jest":"^29.4.0","typescript":"^5.8.3"},"dependencies":{"canvas":"^3.1.2"},"_id":"@100jm/image-resizer@1.0.7","gitHead":"15dd5b273f221cf56bfefd750ee7dc5d5eceb8f0","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-4kZVOlqKfMDhvFyAXsJHpWjbZQv9OFsmk/M7DOVBxkcRxWxsqO5zVIuRfbJcTIYEKa+VWRzyUBn3C2omQSicWA==","shasum":"fae863ab9935d7e28b75edabf6b748f0c13b2cef","tarball":"https://registry.npmjs.org/@100jm/image-resizer/-/image-resizer-1.0.7.tgz","fileCount":16,"unpackedSize":27420,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBxrne8C7DuiOBZ9v/CIKrRauLaZHlYF14iKcFvVHvfkAiEA3gD7vcGXidhLQ5KhxIl1HT2zGP+L4LzUeCSbdlLUV5s="}]},"_npmUser":{"name":"100jm","email":"bjm.931026@gmail.com"},"directories":{},"maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/image-resizer_1.0.7_1753417308948_0.34962043916503216"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-17T06:18:40.324Z","modified":"2025-07-25T04:21:49.318Z","1.0.0":"2025-07-17T06:18:40.606Z","1.0.1":"2025-07-17T06:37:38.770Z","1.0.2":"2025-07-17T06:49:52.844Z","1.0.3":"2025-07-17T07:53:44.156Z","1.0.4":"2025-07-17T08:41:05.647Z","1.0.5":"2025-07-17T08:59:58.974Z","1.0.6":"2025-07-18T01:50:21.452Z","1.0.7":"2025-07-25T04:21:49.137Z"},"bugs":{"url":"https://github.com/100JM/image-resizer/issues"},"author":{"name":"100jm"},"license":"MIT","homepage":"https://github.com/100JM/image-resizer#readme","keywords":["resize","image","typescript","photo","thumbnail","resizer"],"repository":{"type":"git","url":"git+https://github.com/100JM/image-resizer.git"},"description":"resize image function","maintainers":[{"name":"100jm","email":"bjm.931026@gmail.com"}],"readme":"# @100jm/image-resizer\r\n\r\nA TypeScript library for resizing images in both browser and Node.js environments with automatic environment detection.\r\n\r\n## Features\r\n\r\n- 🖼️ **Cross-platform**: Works in both browser and Node.js environments\r\n- 🔄 **Auto-detection**: Automatically detects environment and uses appropriate method\r\n- 📦 **TypeScript**: Full TypeScript support with type definitions\r\n- ⚡ **Promise-based**: Modern async/await API\r\n- 🔧 **Configurable**: Quality, format, and smoothing options\r\n- 📏 **Aspect ratio preservation**: Maintains image proportions\r\n- 🚀 **Lightweight**: No heavy dependencies\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @100jm/image-resizer\r\n```\r\n\r\n## Usage\r\n\r\n### Basic Usage\r\n\r\n```typescript\r\nimport { resizer } from '@100jm/image-resizer';\r\n\r\n// Resize an image file\r\nconst result = await resizer(imageFile, 800, 600, {\r\n  quality: 0.8,\r\n  format: 'jpeg'\r\n});\r\n\r\nconsole.log(`Resized from ${result.originalWidth}x${result.originalHeight} to ${result.width}x${result.height}`);\r\n```\r\n\r\n### Browser Environment\r\n\r\n```typescript\r\nimport { resizer } from '@100jm/image-resizer';\r\n\r\n// Handle file input\r\nconst fileInput = document.getElementById('fileInput') as HTMLInputElement;\r\nconst file = fileInput.files[0];\r\n\r\nif (file) {\r\n  try {\r\n    const result = await resizer(file, 1024, 768, {\r\n      quality: 0.9,\r\n      format: 'jpeg',\r\n      imageSmoothingQuality: 'high'\r\n    });\r\n    \r\n    // Use the resized image blob\r\n    const img = document.createElement('img');\r\n    img.src = URL.createObjectURL(result.data);\r\n    document.body.appendChild(img);\r\n    \r\n    console.log('Resized successfully:', result);\r\n  } catch (error) {\r\n    console.error('Image resize failed:', error);\r\n  }\r\n}\r\n```\r\n\r\n### Node.js Environment\r\n\r\n```typescript\r\nimport { resizer } from '@100jm/image-resizer';\r\nimport { readFileSync, writeFileSync } from 'fs';\r\n\r\n// Read image file\r\nconst imageBuffer = readFileSync('./input.jpg');\r\n\r\n// Resize image\r\nconst result = await resizer(imageBuffer, 800, 600, {\r\n  quality: 0.8\r\n});\r\n\r\n// Save resized image\r\nwriteFileSync('./output.jpg', result.data);\r\nconsole.log('Resized successfully:', result);\r\n```\r\n\r\n## API Reference\r\n\r\n### `resizer(file, maxWidth, maxHeight, options?)`\r\n\r\nResizes an image file or buffer while maintaining aspect ratio.\r\n\r\n#### Parameters\r\n\r\n- `file` (File | Buffer): The image to resize\r\n- `maxWidth` (number): Maximum width in pixels\r\n- `maxHeight` (number): Maximum height in pixels\r\n- `options` (object, optional): Configuration options\r\n\r\n#### Options\r\n\r\n```typescript\r\ninterface ResizeOptions {\r\n  quality?: number;                    // Image quality (0.1 - 1.0, default: 0.7)\r\n  format?: 'jpeg' | 'png' | 'webp';    // Output format (browser only, default: 'jpeg')\r\n  imageSmoothingEnabled?: boolean;     // Enable image smoothing (default: true)\r\n  imageSmoothingQuality?: 'low' | 'medium' | 'high'; // Smoothing quality (browser only, default: 'high')\r\n}\r\n```\r\n\r\n#### Returns\r\n\r\n**Browser Environment:**\r\n```typescript\r\n{\r\n  data: Blob;           // Resized image as Blob\r\n  width: number;        // Final width\r\n  height: number;       // Final height\r\n  originalWidth: number; // Original width\r\n  originalHeight: number; // Original height\r\n}\r\n```\r\n\r\n**Node.js Environment:**\r\n```typescript\r\n{\r\n  data: Blob;       // Resized image as Blob\r\n  width: number;        // Final width\r\n  height: number;       // Final height\r\n  originalWidth: number; // Original width\r\n  originalHeight: number; // Original height\r\n}\r\n```\r\n\r\n## Examples\r\n\r\n### Maintain Aspect Ratio\r\n\r\n```typescript\r\n// Only specify max dimensions, aspect ratio is preserved\r\nconst result = await resizer(imageFile, 800, 600);\r\nconsole.log(`Resized to ${result.width}x${result.height}`);\r\n```\r\n\r\n### High Quality Output\r\n\r\n```typescript\r\nconst result = await resizer(imageFile, 800, 600, {\r\n  quality: 0.95,\r\n  imageSmoothingQuality: 'high'\r\n});\r\n```\r\n\r\n### Different Formats (Browser)\r\n\r\n```typescript\r\n// PNG format\r\nconst pngResult = await resizer(imageFile, 800, 600, {\r\n  format: 'png',\r\n  quality: 0.9\r\n});\r\n\r\n// WebP format\r\nconst webpResult = await resizer(imageFile, 800, 600, {\r\n  format: 'webp',\r\n  quality: 0.8\r\n});\r\n```\r\n\r\n### Node.js with Buffer\r\n\r\n```typescript\r\nimport { resizer } from '@100jm/image-resizer';\r\n\r\nconst imageBuffer = Buffer.from('...'); // Your image buffer\r\nconst result = await resizer(imageBuffer, 800, 600, {\r\n  quality: 0.8\r\n});\r\n```\r\n\r\n## Environment Detection\r\n\r\nThe library automatically detects the environment:\r\n\r\n- **Browser**: Uses Canvas API with `document.createElement('canvas')`\r\n- **Node.js**: Uses `canvas` package with `createCanvas()`\r\n\r\nNo manual configuration required!\r\n\r\n## Browser Support\r\n\r\n- Chrome 51+\r\n- Firefox 42+\r\n- Safari 10+\r\n- Edge 79+\r\n\r\n## Node.js Support\r\n\r\n- Node.js 14.0.0+\r\n- Requires `canvas` package for image processing\r\n\r\n## Development\r\n\r\n```bash\r\n# Install dependencies\r\nnpm install @100jm/image-resizer\r\n\r\n# Build the library (CommonJS + ES Modules)\r\nnpm run build\r\n\r\n# Run tests\r\nnpm test\r\n\r\n# Development mode with watch\r\nnpm run dev\r\n\r\n# Clean build directory\r\nnpm run clean\r\n```\r\n\r\n- **TypeScript Target**: ES6\r\n- **Module Systems**: CommonJS + ES Modules (dual build)\r\n- **Build Output**:\r\n  - `dist/cjs/` - CommonJS modules for Node.js\r\n  - `dist/mjs/` - ES Modules for modern bundlers\r\n\r\nThe library uses conditional exports to provide the optimal module format:\r\n- CommonJS environments: Uses `dist/cjs/` files\r\n- ES Modules environments: Uses `dist/mjs/` files\r\n\r\n## License\r\n\r\nMIT\r\n\r\n## Contributing\r\n\r\n1. Fork the repository\r\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\r\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\r\n4. Push to the branch (`git push origin feature/amazing-feature`)\r\n5. Open a Pull Request\r\n\r\n## Issues\r\n\r\nIf you find any issues, please report them on the [GitHub issues page](https://github.com/100JM/image-resizer/issues).","readmeFilename":"README.md"}