{"_id":"@btheegg-kimth/img2webp","_rev":"2-eafd9d7206e9b036aa8d123842dad364","name":"@btheegg-kimth/img2webp","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@btheegg-kimth/img2webp","version":"0.0.1","keywords":["webp","img2webp","libwebp","wasm","animation","png","jpeg","browser"],"author":{"name":"btheegg-kimth"},"license":"MIT","_id":"@btheegg-kimth/img2webp@0.0.1","maintainers":[{"name":"kth32105","email":"kimth32105@gmail.com"}],"homepage":"https://github.com/horororok/webp-tools/tree/main/packages/img2webp","bugs":{"url":"https://github.com/horororok/webp-tools/issues"},"dist":{"shasum":"19b3016e10af6a09b6a5b6d63ce65b431f3ef0df","tarball":"https://registry.npmjs.org/@btheegg-kimth/img2webp/-/img2webp-0.0.1.tgz","fileCount":11,"integrity":"sha512-0fwho47tn7O7ozYerGhUBN8xz4D6o107iGWOtxFM2r6Ejdop2qqCX2jJUbDghQdP0OFuI3TmxbaG+lNTYj18ng==","signatures":[{"sig":"MEUCIQD5JhDTiBN5LfQluZeGRw/Vd7lrm+YF34xtiepnnN26lgIgYdOagEQUJ2Nh95jioSr0hJpxZjRqEdKrX72SGZQ55Ig=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1135743},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./package.json":"./package.json"},"gitHead":"91968b043a022c97d8007dbe694f41feeed9cd2a","scripts":{"build":"tsdown","typecheck":"tsc --noEmit"},"_npmUser":{"name":"kth32105","email":"kimth32105@gmail.com"},"repository":{"url":"git+https://github.com/horororok/webp-tools.git","type":"git","directory":"packages/img2webp"},"_npmVersion":"10.9.2","description":"Frames (PNG/JPEG/WebP) -> animated WebP in the browser, via libwebp img2webp compiled to WASM.","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"unrun":"^0.3.0","tsdown":"^0.22.0","typescript":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/img2webp_0.0.1_1780376075892_0.3119606977959033","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"_id":"@btheegg-kimth/img2webp@0.0.2","bugs":{"url":"https://github.com/horororok/webp-tools/issues"},"dist":{"shasum":"a5e84dfe1bad0c612ede7d9deb75246ce838de8d","tarball":"https://registry.npmjs.org/@btheegg-kimth/img2webp/-/img2webp-0.0.2.tgz","fileCount":11,"integrity":"sha512-TAMZv6wrSeG+ess8FqbNedAAGpjhxI2FQFwObaRYApfgc/av+Bcn/+xbS/o4y+/Z2/d94PInG2ktmOdNh+BNYw==","signatures":[{"sig":"MEUCIQDnLp5ryY/OHMeWBO3aBdgJf/gujTBNasR9ckForxAnDQIgVvAy+UEp9Q4JlLDV7B9dggMvXn5KZsmYtXK8h5VD080=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD5+o3p+mvNNImrx2ttRWB7YCaHx3OtjDz1xB64Py8vmgIhAPBH+cf1zhaNT7twuhOuU6b3UMGvPVlv/HO7+N5ko5No"}],"unpackedSize":1136576},"main":"./dist/index.mjs","name":"@btheegg-kimth/img2webp","type":"module","types":"./dist/index.d.mts","author":{"name":"btheegg-kimth"},"module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./package.json":"./package.json"},"gitHead":"91e23ebce9a70e02ec3cf1897ac9a5afee575288","license":"MIT","scripts":{"build":"tsdown","typecheck":"tsc --noEmit"},"version":"0.0.2","_npmUser":{"name":"kth32105","email":"kimth32105@gmail.com"},"homepage":"https://github.com/horororok/webp-tools/tree/main/packages/img2webp","keywords":["webp","img2webp","libwebp","wasm","animation","png","jpeg","browser"],"repository":{"url":"git+https://github.com/horororok/webp-tools.git","type":"git","directory":"packages/img2webp"},"_npmVersion":"11.16.0","description":"Frames (PNG/JPEG/WebP) -> animated WebP in the browser, via libwebp img2webp compiled to WASM.","directories":{},"maintainers":[{"name":"kth32105","email":"kimth32105@gmail.com"}],"sideEffects":false,"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"unrun":"^0.3.0","tsdown":"^0.22.0","typescript":"^6.0.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/img2webp_0.0.2_1790920211696_0.6485154841279934"}}},"time":{"created":"2026-06-02T04:54:35.693Z","modified":"2026-10-02T05:50:12.281Z","0.0.1":"2026-06-02T04:54:36.129Z","0.0.2":"2026-10-02T05:50:11.794Z"},"bugs":{"url":"https://github.com/horororok/webp-tools/issues"},"author":{"name":"btheegg-kimth"},"license":"MIT","homepage":"https://github.com/horororok/webp-tools/tree/main/packages/img2webp","keywords":["webp","img2webp","libwebp","wasm","animation","png","jpeg","browser"],"repository":{"url":"git+https://github.com/horororok/webp-tools.git","type":"git","directory":"packages/img2webp"},"description":"Frames (PNG/JPEG/WebP) -> animated WebP in the browser, via libwebp img2webp compiled to WASM.","maintainers":[{"name":"kth32105","email":"kimth32105@gmail.com"}],"readme":"# @btheegg-kimth/img2webp\n\n**여러 장의 이미지(PNG·JPEG·WebP)를 한 개의 애니메이션 WebP로 묶습니다** —\n브라우저에서, libwebp `img2webp`를 WASM으로 컴파일해 수행.\n\n쉽게 말해 **\"이미지 여러 장 → 움직이는 WebP 한 장\"** 입니다. 프레임 시퀀스나\n슬라이드쇼, 짧은 모션을 프레임마다 표시 시간을 지정해 가벼운 애니메이션 WebP로\n만들 때 씁니다. 입력 이미지는 GIF처럼 압축 손실이 큰 포맷을 거치지 않고 PNG/JPEG\n원본에서 바로 인코딩되므로 화질·용량 면에서 유리합니다.\n\n왜 라이브러리가 필요한가: 브라우저는 `canvas.toBlob('image/webp')`로 *정적* 한 장은\nWebP로 인코딩하지만, 여러 장을 *애니메이션* WebP로 묶지는 못합니다 — 그 공백을\n메웁니다. 정적 한 장 변환만 필요하면 이 패키지 대신 `canvas.toBlob`를 쓰세요.\n(애니메이션 GIF를 WebP로 바꾸려는 거라면\n[`@btheegg-kimth/gif2webp`](https://www.npmjs.com/package/@btheegg-kimth/gif2webp).)\n\n## 설치\n\n```sh\npnpm add @btheegg-kimth/img2webp\n```\n\n## 사용법\n\n```ts\nimport { img2webp } from \"@btheegg-kimth/img2webp\";\n\n// 가장 단순한 형태: 바이트 배열만 (프레임당 100ms, 무한 루프는 loopCount로)\nconst frames = [png0, png1, png2]; // 각각 Uint8Array (PNG/JPEG/WebP)\nconst webp = await img2webp(frames, {\n  loopCount: 0,                       // 0 = 무한 반복\n  defaultFrame: { duration: 100, quality: 80 },\n});\n\nconst blob = new Blob([webp], { type: \"image/webp\" });\n```\n\n프레임마다 다른 지속시간/품질을 주려면 객체 형태로:\n\n```ts\nconst webp = await img2webp([\n  { data: png0, duration: 500 },                 // 첫 장 0.5초\n  { data: png1, duration: 80, lossless: true },  // 둘째 장 80ms, 무손실\n  png2,                                          // 기본값(defaultFrame) 적용\n], { loopCount: 0, defaultFrame: { duration: 100 } });\n```\n\n### 입력 포맷\n\nPNG · JPEG · WebP · PNM. 포맷은 **콘텐츠(매직 바이트)로 자동 감지**되므로 파일명/\n확장자를 신경 쓸 필요 없습니다. (GIF는 입력으로 받지 않습니다 — 애니메이션 GIF →\nWebP는 [`@btheegg-kimth/gif2webp`](https://www.npmjs.com/package/@btheegg-kimth/gif2webp)를 쓰세요.)\n\n### 옵션\n\nfile-level 옵션 (`img2webp(frames, options)`의 `options`):\n\n| 옵션 | 플래그 | 비고 |\n|------|--------|------|\n| `loopCount` | `-loop` | 0 = 무한 |\n| `minimizeSize` | `-min_size` | |\n| `kmin` / `kmax` | `-kmin` / `-kmax` | 키프레임 간격 |\n| `mixed` | `-mixed` | 프레임별 lossy/lossless 자동 |\n| `nearLossless` | `-near_lossless` | 0..100, 100=off |\n| `sharpYuv` | `-sharp_yuv` | |\n| `defaultFrame` | — | 전 프레임 공통 프레임 옵션 |\n| `extraArgs` | — | 원시 전달 |\n\nper-frame 옵션 (`Img2WebpFrame` 또는 `defaultFrame`):\n\n| 옵션 | 플래그 | 비고 |\n|------|--------|------|\n| `duration` | `-d` | 프레임 표시 시간(ms), 기본 100 |\n| `quality` | `-q` | 0..100 |\n| `method` | `-m` | 0..6, 높을수록 느리고 작음 |\n| `lossless` / `lossy` | `-lossless` / `-lossy` | 둘 다 주면 lossless 우선 |\n| `exact` | `-exact` | 투명 영역 RGB 보존 |\n\n## 비고\n\n- WASM은 단일 `.mjs`에 인라인돼 있으며(`SINGLE_FILE=1`), 첫 호출 때 lazy 로드됩\n  니다. 변환 경로에서만 `img2webp`를 import하면 메인 번들이 부풀지 않습니다.\n- **pthread 비활성** 빌드이므로 COOP/COEP 헤더, SharedArrayBuffer 등 추가 요구사\n  항 없음 — Vite/Webpack/Next 등 일반 환경에서 그대로 동작.\n- 호출은 내부 mutex로 직렬화 — `Promise.all`로 여러 변환을 동시에 걸어도 안전.\n- **0.0.1을 쓰고 있다면 0.0.2로 올리세요.** 0.0.1은 한 페이지에서 반복 호출하면 wasm\n  스택이 조금씩 새서, 프레임 4장 기준 약 100번째 호출에서 크래시하고 그 뒤로는 멈췄습니다.\n- 변환하는 동안 메인 스레드가 멈춥니다. 직접 만든 Web Worker 안에서 호출해도 됩니다.\n  Vite 7 이하에서 워커 안에서 쓰려면 vite.config에 `worker: { format: \"es\" }`가\n  필요합니다(기본 형식 iife는 wasm의 지연 로딩에 쓰는 동적 import를 지원하지 않음).\n- libwebp(BSD-3-Clause) + libpng(PNG License) + zlib(Zlib License) +\n  libjpeg-turbo(IJG/BSD-3-Clause)로 빌드됨. `THIRD_PARTY_LICENSES.md` 참고.\n- 래퍼 코드는 MIT.\n","readmeFilename":"README.md"}