{"_id":"image-crop-or-pad","_rev":"2-0fd3341e0e4d94595985a64e951d760f","name":"image-crop-or-pad","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"image-crop-or-pad","version":"1.0.0","keywords":["image","resize","crop","pad","visual","regression","testing","pixelmatch"],"author":{"name":"David Hunt"},"license":"ISC","_id":"image-crop-or-pad@1.0.0","maintainers":[{"name":"dnotes","email":"davidhuntatwork@gmail.com"}],"homepage":"https://github.com/dnotes/image-crop-or-pad#readme","bugs":{"url":"https://github.com/dnotes/image-crop-or-pad/issues"},"dist":{"shasum":"9cef99a5f69c949061d2a6d0a98365e7c07d5cb9","tarball":"https://registry.npmjs.org/image-crop-or-pad/-/image-crop-or-pad-1.0.0.tgz","fileCount":6,"integrity":"sha512-CkAp7Mfx5FQEs8VzMe/eApNDbTzJQ0MVCXJ9h4ffRS2CuP1RAT/Vkj0yVJsc2Fk5p32Rtfv5Z1GYeTVF0Zu89g==","signatures":[{"sig":"MEUCIEH/ZJU2Efdk6fj3qfHhAkgIb664P3qhOw0PuofhZj9DAiEAygFyBepo4NKJ/JaQWHIGiWghWnGX24HSUFEd/l4Ubkk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13629},"main":"dist/index.cjs.js","type":"module","module":"dist/index.esm.js","exports":{"import":"./dist/index.esm.js","require":"./dist/index.cjs.js"},"gitHead":"d3ba805d890e791379bfa9e2eee8beff0c3d1776","scripts":{"dev":"vite dev","test":"vitest --no-watch","build":"rollup -c && vite build","check":"svelte-kit sync && svelte-check --tsconfig ./jsconfig.json","prepare":"svelte-kit sync || echo ''","preview":"vite preview","test:ci":"vitest --no-watch --project node","test:watch":"vitest","check:watch":"svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"},"_npmUser":{"name":"dnotes","email":"davidhuntatwork@gmail.com"},"repository":{"url":"git+https://github.com/dnotes/image-crop-or-pad.git","type":"git"},"_npmVersion":"10.8.2","description":"A tiny, fully-tested utility to resize raw image data in node or browser, intended for visual regression testing.","directories":{},"_nodeVersion":"20.19.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^6.2.6","pngjs":"^7.0.0","buffer":"^6.0.3","mdsvex":"^0.12.3","rollup":"^4.41.1","svelte":"^5.0.0","vitest":"^3.1.4","pixelmatch":"^7.1.0","playwright":"^1.52.0","typescript":"^5.0.0","quickpickle":"^1.9.0","tailwindcss":"^4.0.0","@types/pngjs":"^6.0.5","svelte-check":"^4.0.0","@sveltejs/kit":"^2.16.0","@vitest/browser":"^3.1.4","@tailwindcss/vite":"^4.0.0","@tailwindcss/forms":"^0.5.9","@rollup/plugin-terser":"^0.4.4","vitest-browser-svelte":"^0.1.0","@rollup/plugin-commonjs":"^28.0.3","@tailwindcss/typography":"^0.5.15","@sveltejs/adapter-static":"^3.0.8","@quickpickle/vitest-browser":"^0.2.0","@rollup/plugin-node-resolve":"^16.0.1","@sveltejs/vite-plugin-svelte":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/image-crop-or-pad_1.0.0_1748450929132_0.09866374197918537","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"image-crop-or-pad","version":"1.0.1","description":"A tiny, fully-tested utility to resize raw image data in node or browser, intended for visual regression testing.","type":"module","main":"dist/index.cjs","module":"dist/index.esm.js","types":"dist/resize-image.d.ts","exports":{"import":{"types":"./dist/resize-image.d.ts","default":"./dist/index.esm.js"},"require":{"types":"./dist/resize-image.d.ts","default":"./dist/index.cjs"}},"scripts":{"dev":"vite dev","build":"rollup -c && tsc -p tsconfig.build.json && vite build","preview":"vite preview","prepare":"svelte-kit sync || echo ''","check":"svelte-kit sync && svelte-check --tsconfig ./jsconfig.json","check:watch":"svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch","test:ci":"vitest --no-watch --project node","test:watch":"vitest","test":"vitest --no-watch"},"repository":{"type":"git","url":"git+https://github.com/dnotes/image-crop-or-pad.git"},"keywords":["image","resize","crop","pad","visual","regression","testing","pixelmatch"],"author":{"name":"David Hunt"},"license":"ISC","bugs":{"url":"https://github.com/dnotes/image-crop-or-pad/issues"},"homepage":"https://github.com/dnotes/image-crop-or-pad#readme","devDependencies":{"@quickpickle/vitest-browser":"^0.2.0","@rollup/plugin-commonjs":"^28.0.3","@rollup/plugin-node-resolve":"^16.0.1","@rollup/plugin-terser":"^0.4.4","@sveltejs/adapter-static":"^3.0.8","@sveltejs/kit":"^2.16.0","@sveltejs/vite-plugin-svelte":"^5.0.0","@tailwindcss/forms":"^0.5.9","@tailwindcss/typography":"^0.5.15","@tailwindcss/vite":"^4.0.0","@types/pngjs":"^6.0.5","@vitest/browser":"^3.1.4","buffer":"^6.0.3","color-name":"^2.1.0","mdsvex":"^0.12.3","pixelmatch":"^7.1.0","playwright":"^1.52.0","pngjs":"^7.0.0","quickpickle":"^1.9.0","rollup":"^4.41.1","svelte":"^5.0.0","svelte-check":"^4.0.0","tailwindcss":"^4.0.0","typescript":"^5.0.0","vite":"^6.2.6","vitest":"^3.1.4","vitest-browser-svelte":"^0.1.0"},"gitHead":"73558e3babf27128b27fd4ad3aa467599cb1625c","_id":"image-crop-or-pad@1.0.1","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-0Gu+rHoFyKLZ14oaj+CJCElQz/5EOlMHvO9WwsANukerPSGG4MFpC81oDbvsN1wMbSzAhsgTPvgbBICl7ecazg==","shasum":"65a601b5f46e89288d0540d41b26318f5da123c0","tarball":"https://registry.npmjs.org/image-crop-or-pad/-/image-crop-or-pad-1.0.1.tgz","fileCount":10,"unpackedSize":16553,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCID3ByhkgGdocmUI7kgqB9xAA4Yz7mtLdDfR6puROik85AiEAso5P8CSagAT7lXfrNvG6OQ7DGp0iHPUS5e3+uv6LpcM="}]},"_npmUser":{"name":"dnotes","email":"davidhuntatwork@gmail.com"},"directories":{},"maintainers":[{"name":"dnotes","email":"davidhuntatwork@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/image-crop-or-pad_1.0.1_1767908933793_0.6616095018964472"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-28T16:48:49.131Z","modified":"2026-01-08T21:48:54.133Z","1.0.0":"2025-05-28T16:48:49.291Z","1.0.1":"2026-01-08T21:48:53.943Z"},"bugs":{"url":"https://github.com/dnotes/image-crop-or-pad/issues"},"author":{"name":"David Hunt"},"license":"ISC","homepage":"https://github.com/dnotes/image-crop-or-pad#readme","keywords":["image","resize","crop","pad","visual","regression","testing","pixelmatch"],"repository":{"type":"git","url":"git+https://github.com/dnotes/image-crop-or-pad.git"},"description":"A tiny, fully-tested utility to resize raw image data in node or browser, intended for visual regression testing.","maintainers":[{"name":"dnotes","email":"davidhuntatwork@gmail.com"}],"readme":"# image-crop-or-pad\n\nA tiny, fully-tested utility to resize images by cropping or padding, intended to assist with visual regression testing of components.\n\nSee the demo site at https://image-crop-or-pad.pages.dev.\n\n## Installation\n\n```bash\nnpm install image-crop-or-pad\n```\n\n## Usage\n\n```javascript\nimport { resizeImage } from 'image-crop-or-pad';\n\n// Example: Resize an 8-bit RGBA image\nconst originalImage = new Uint8Array(/* your image data */);\nconst originalWidth = 100;\nconst originalHeight = 100;\nconst newWidth = 150;\nconst newHeight = 150;\n\nconst resizedImage = resizeImage(\n  originalImage,\n  originalWidth,\n  originalHeight,\n  newWidth,\n  newHeight,\n  {\n    rgba: [255, 255, 255, 255], // White padding\n    anchor: \"center\" // Center the original image on the new canvas\n  }\n);\n```\n\n## Options\n\n- `rgba`: The RGBA values for padded pixels (0-255), default [0,0,0,0]\n- `anchor`: The anchor position for the resize operation, default \"top left\"\n  - Possible values: \"top left\", \"top right\", \"bottom left\", \"bottom right\", \"top\", \"bottom\", \"left\", \"right\", \"center\"\n","readmeFilename":"README.md"}