nbinlineai.browser_transform_tools
Create bounded image and video derivatives from owned media.
Direct Python calls return mutable receipts before decoding or saving finishes. Inspect them in a later cell. Model tools receive bounded initial status and media descriptors, not derivative image pixels. Source media stays unchanged.
extract_frames
extract_frames(media: dict, timestamps: list[float], save_to: str | None = None) -> BrowserReceiptRequest up to twelve video frames as memory images or saved PNGs.
With save_to=None, the completed Python result is a list of PIL images.
| Parameter | Type | Default | Description |
|---|---|---|---|
media |
dict | required | Owned MediaRef with media_id, or an exact saved path and SHA-256 hash. |
timestamps |
list[float] | required | One through twelve finite timestamps in seconds, each from 0 through 300. |
save_to |
str | None | None |
None keeps media in memory; auto or a server-root-relative path saves a new file. |
| returns | BrowserReceipt | Mutable browser receipt; inspect its later status and result. |
crop_image
crop_image(media: dict, x: int, y: int, width: int, height: int, save_to: str | None = None) -> BrowserReceiptRequest a new PNG crop without changing its exact source.
| Parameter | Type | Default | Description |
|---|---|---|---|
media |
dict | required | Owned MediaRef with media_id, or an exact saved path and SHA-256 hash. |
x |
int | required | Left crop coordinate in pixels, from 0 through 4096. |
y |
int | required | Top crop coordinate in pixels, from 0 through 4096. |
width |
int | required | Crop width in pixels, from 1 through 4096. |
height |
int | required | Crop height in pixels, from 1 through 4096. |
save_to |
str | None | None |
None keeps media in memory; auto or a server-root-relative path saves a new file. |
| returns | BrowserReceipt | Mutable browser receipt; inspect its later status and result. |
annotate_image
annotate_image(media: dict, annotations: list[dict], save_to: str | None = None) -> BrowserReceiptRequest a new PNG with text, shapes, or opaque redactions.
| Parameter | Type | Default | Description |
|---|---|---|---|
media |
dict | required | Owned MediaRef with media_id, or an exact saved path and SHA-256 hash. |
annotations |
list[dict] | required | One through fifty text, arrow, rectangle, or redaction shapes. |
save_to |
str | None | None |
None keeps media in memory; auto or a server-root-relative path saves a new file. |
| returns | BrowserReceipt | Mutable browser receipt; inspect its later status and result. |