@poof-bg/js 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ fs.writeFileSync('output.png', Buffer.from(result.data));
|
|
|
116
116
|
|
|
117
117
|
### Video
|
|
118
118
|
|
|
119
|
-
Videos go through the same `removeBackground()` call. Because a clip takes a while to process, the call returns a `Job` instead of bytes: wait for it with `waitForJob()` (or pass `wait: true`), then download `resultUrl`. Output is a transparent VP9 WebM by default; `format` can also be `mov` (ProRes 4444 with alpha)
|
|
119
|
+
Videos go through the same `removeBackground()` call. Because a clip takes a while to process, the call returns a `Job` instead of bytes: wait for it with `waitForJob()` (or pass `wait: true`), then download `resultUrl`. Output is a transparent VP9 WebM by default; `format` can also be `mov` (ProRes 4444 with alpha), `mp4` (H.264, composited on `bgColor`, default white) or `gif` (looping GIF with 1-bit transparency and no audio, capped at 720p, for stickers and chat; pass `size: 'preview'` for sticker-sized output). Audio is kept except for `gif`. An animated GIF is accepted as input too. Each started second of video costs 5 credits (10 above 30 fps), charged when the job is accepted and refunded if it fails.
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
122
|
import { Poof } from '@poof-bg/js';
|
|
@@ -142,10 +142,10 @@ Shorter: `wait: true` submits and waits in one call.
|
|
|
142
142
|
|
|
143
143
|
```typescript
|
|
144
144
|
const done = await poof.removeBackground('./clip.mp4', {
|
|
145
|
-
format: 'mp4', // 'webm' (transparent) | 'mov' (transparent ProRes) | 'mp4' (opaque)
|
|
145
|
+
format: 'mp4', // 'webm' (transparent) | 'mov' (transparent ProRes) | 'mp4' (opaque) | 'gif' (1-bit transparent)
|
|
146
146
|
channels: 'rgba', // 'rgba' | 'rgb' | 'alpha' (grayscale matte video, no audio)
|
|
147
147
|
bgColor: '#00ff00', // Background for opaque output (mp4 or channels 'rgb'); default white
|
|
148
|
-
size: 'hd', // Longest side cap;
|
|
148
|
+
size: 'hd', // Longest side cap: 640 / 1280 / 1920 (hd); 'full' keeps the source up to 4K
|
|
149
149
|
wait: { pollIntervalMs: 5000, timeoutMs: 15 * 60 * 1000 },
|
|
150
150
|
});
|
|
151
151
|
```
|
|
@@ -258,7 +258,7 @@ const poof = new Poof({
|
|
|
258
258
|
| File path (string) | ❌ | ✅ |
|
|
259
259
|
| `{ url: string }` (public https URL) | ✅ | ✅ |
|
|
260
260
|
|
|
261
|
-
Images: PNG, JPEG, WebP, GIF
|
|
261
|
+
Images: PNG, JPEG, WebP, single-frame GIF, up to 20 MB. Videos: MP4, MOV, WebM, MKV, animated GIF, up to 100 MB uploaded or 500 MB by URL, up to 5 minutes.
|
|
262
262
|
|
|
263
263
|
## TypeScript
|
|
264
264
|
|
package/dist/index.d.cts
CHANGED
|
@@ -13,10 +13,14 @@ interface PoofOptions {
|
|
|
13
13
|
/** Output image format */
|
|
14
14
|
type ImageFormat = 'png' | 'jpg' | 'webp';
|
|
15
15
|
/** Output video format: VP9 WebM (alpha or opaque), ProRes MOV (alpha or opaque) or H.264 MP4 (opaque) */
|
|
16
|
-
type VideoFormat = 'webm' | 'mov' | 'mp4';
|
|
16
|
+
type VideoFormat = 'webm' | 'mov' | 'mp4' | 'gif';
|
|
17
17
|
/** Output color channels */
|
|
18
18
|
type Channels = 'rgba' | 'rgb' | 'alpha';
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Output size preset. Images: megapixel cap. Videos: longest side capped at
|
|
21
|
+
* 640 (preview), 1280 (medium) or 1920 (hd); 'full' keeps the source
|
|
22
|
+
* resolution up to 4096 px (4K).
|
|
23
|
+
*/
|
|
20
24
|
type ImageSize = 'full' | 'preview' | 'medium' | 'hd';
|
|
21
25
|
/**
|
|
22
26
|
* How the image is fitted into a fixed width/height (never stretched):
|
package/dist/index.d.ts
CHANGED
|
@@ -13,10 +13,14 @@ interface PoofOptions {
|
|
|
13
13
|
/** Output image format */
|
|
14
14
|
type ImageFormat = 'png' | 'jpg' | 'webp';
|
|
15
15
|
/** Output video format: VP9 WebM (alpha or opaque), ProRes MOV (alpha or opaque) or H.264 MP4 (opaque) */
|
|
16
|
-
type VideoFormat = 'webm' | 'mov' | 'mp4';
|
|
16
|
+
type VideoFormat = 'webm' | 'mov' | 'mp4' | 'gif';
|
|
17
17
|
/** Output color channels */
|
|
18
18
|
type Channels = 'rgba' | 'rgb' | 'alpha';
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Output size preset. Images: megapixel cap. Videos: longest side capped at
|
|
21
|
+
* 640 (preview), 1280 (medium) or 1920 (hd); 'full' keeps the source
|
|
22
|
+
* resolution up to 4096 px (4K).
|
|
23
|
+
*/
|
|
20
24
|
type ImageSize = 'full' | 'preview' | 'medium' | 'hd';
|
|
21
25
|
/**
|
|
22
26
|
* How the image is fitted into a fixed width/height (never stretched):
|