From 93685d236b87fac30d87e94559192bb4babcd947 Mon Sep 17 00:00:00 2001 From: Diretnan Domnan Date: Thu, 28 Aug 2025 14:37:10 +0200 Subject: [PATCH] IMAGES-1735: Adding segment to documentation --- .../transform-images/transform-via-url.mdx | 6 +++++- .../transform-via-workers.mdx | 6 +++++- src/content/partials/images/segment.mdx | 21 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/content/partials/images/segment.mdx diff --git a/src/content/docs/images/transform-images/transform-via-url.mdx b/src/content/docs/images/transform-images/transform-via-url.mdx index 3f7d5449b90a592..4341403b3dd4bc4 100644 --- a/src/content/docs/images/transform-images/transform-via-url.mdx +++ b/src/content/docs/images/transform-images/transform-via-url.mdx @@ -115,6 +115,10 @@ You must specify at least one option. Options are comma-separated (spaces are no +### `segment` + + + ### `sharpen` @@ -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. \ No newline at end of file diff --git a/src/content/docs/images/transform-images/transform-via-workers.mdx b/src/content/docs/images/transform-images/transform-via-workers.mdx index 668694e40313f62..5a90a560c4e879a 100644 --- a/src/content/docs/images/transform-images/transform-via-workers.mdx +++ b/src/content/docs/images/transform-images/transform-via-workers.mdx @@ -103,6 +103,10 @@ The `fetch()` function accepts parameters in the second argument inside the `{cf +### `segment` + + + ### `sharpen` @@ -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. \ No newline at end of file diff --git a/src/content/partials/images/segment.mdx b/src/content/partials/images/segment.mdx new file mode 100644 index 000000000000000..c4618818db1c53d --- /dev/null +++ b/src/content/partials/images/segment.mdx @@ -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/). + + + + ```js + segment=foreground + ``` + + + ```js + cf: {segment: "foreground"} + ``` + + \ No newline at end of file