Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ You must specify at least one option. Options are comma-separated (spaces are no

<Render file="saturation" product="images" />

### `segment`

<Render file="segment" product="images" />

### `sharpen`

<Render file="sharpen" product="images" />
Expand Down Expand Up @@ -167,4 +171,4 @@ If Custom Cache Keys are used for the origin image, the origin image might not b

Resized images follow the same caching rules as the original image they were resized from, except the minimum cache time is one hour. If you need images to be updated more frequently, add `must-revalidate` to the `Cache-Control` header. Resizing supports cache revalidation, so we recommend serving images with the `Etag` header. Refer to the [Cache docs for more information](/cache/concepts/cache-control/#revalidation).

Cloudflare Images does not support purging resized variants individually. URLs starting with `/cdn-cgi/` cannot be purged. However, purging of the original image's URL will also purge all of its resized variants.
Cloudflare Images does not support purging resized variants individually. URLs starting with `/cdn-cgi/` cannot be purged. However, purging of the original image's URL will also purge all of its resized variants.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ The `fetch()` function accepts parameters in the second argument inside the `{cf

<Render file="saturation" product="images" />

### `segment`

<Render file="segment" product="images" />

### `sharpen`

<Render file="sharpen" product="images" />
Expand Down Expand Up @@ -286,4 +290,4 @@ When testing image resizing, please deploy the script first. Resizing will not b

Resized images are always cached. They are cached as additional variants under a cache entry for the URL of the full-size source image in the `fetch` subrequest. Do not worry about using many different Workers or many external URLs — they do not influence caching of resized images, and you do not need to do anything for resized images to be cached correctly.

If you use the `cacheKey` fetch option to unify the caches of multiple source URLs, do not include any resizing options in the `cacheKey`. Doing so will fragment the cache and hurt caching performance. The `cacheKey` should reference only the full-size source image URL, not any of its resized versions.
If you use the `cacheKey` fetch option to unify the caches of multiple source URLs, do not include any resizing options in the `cacheKey`. Doing so will fragment the cache and hurt caching performance. The `cacheKey` should reference only the full-size source image URL, not any of its resized versions.
21 changes: 21 additions & 0 deletions src/content/partials/images/segment.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
{}
---
import { Tabs, TabItem } from "~/components"

Automatically isolates the subject of an image by replacing the background with transparent pixels.

This feature uses an open-source model called BiRefNet through Workers AI. Read more about Cloudflare's [approach to responsible AI](https://www.cloudflare.com/trust-hub/responsible-ai/).

<Tabs>
<TabItem label="URL format">
```js
segment=foreground
```
</TabItem>
<TabItem label="Workers">
```js
cf: {segment: "foreground"}
```
</TabItem>
</Tabs>
Loading