# Image Understanding and Segmentation Mask Support

**URL:** <https://discuss.ai.google.dev/t/image-understanding-and-segmentation-mask-support/146559>\
**Category:** Gemini API\
**Tags:** api\
**Created:** [May 20, 2026, 9:09pm UTC](https://discuss.ai.google.dev/t/image-understanding-and-segmentation-mask-support/146559 "2026-05-20T21:09:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![im\_peterj](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/im_peterj/32/123991_2.png) [@im\_peterj](https://discuss.ai.google.dev/u/im_peterj)\
**Post date:** [May 20, 2026, 9:09pm UTC](https://discuss.ai.google.dev/t/image-understanding-and-segmentation-mask-support/146559/1 "2026-05-20T21:09:52Z")

</div>

Are segmentation masks still supported? It is unclear what the current support is for the generation of image segmentation masks.

According to the [docs](https://ai.google.dev/gemini-api/docs/interactions/image-understanding#segmentation), “starting with Gemini 2.5, models not only detect items but also segment them and provide their contour masks.”

The docs say that the segmentation masks are given as a base64 png that is a probability map with values between 0 and 255.

From the example in the docs, the following prompt suggests how to instruct gemini to give the segmentation masks:

```python
prompt = """
Give the segmentation masks for the wooden and glass items.
Output a JSON list of segmentation masks where each entry contains the 2D
bounding box in the key "box_2d", the segmentation mask in key "mask", and
the text label in the key "label". Use descriptive labels.
"""

```

However, the behavior of segmentation masks is inconsistent across model versions.

Gemini 2.5 currently produces segmentations mask results like this:

```python
{"mask": "<start_of_mask><seg_4><seg_20><seg_4><seg_35><seg_65><seg_27><seg_27>"}

```

While Gemini 3.5 produces the segmentation mask of the item as a polygon of [x,y] coordinates like this:

```python
{"mask": [[325, 411], [327, 471], [332, 523], [397, 534], [403, 492], [408, 426]]}

```

In both of these cases the segmentation masks are not produced as base64 png.

Has support for segmentation masks been changed? What is the expected behavior?

---

<div class="post-metadata">

**Author:** ![joelo](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/joelo/32/31788_2.png) [@joelo](https://discuss.ai.google.dev/u/joelo)\
**Post date:** [May 22, 2026, 7:34am UTC](https://discuss.ai.google.dev/t/image-understanding-and-segmentation-mask-support/146559/2 "2026-05-22T07:34:20Z")

</div>

The [release notes](https://ai.google.dev/gemini-api/docs/interactions/whats-new-gemini-3.5) explicitly state segmentation is no longer supported:

> Image segmentation is not supported in Gemini 3.x. For segmentation workloads, continue using Gemini 2.5 Flash with thinking off, or [Gemini Robotics-ER 1.6](https://ai.google.dev/gemini-api/docs/robotics-overview).

---

<div class="post-metadata">

**Author:** ![im\_peterj](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/im_peterj/32/123991_2.png) [@im\_peterj](https://discuss.ai.google.dev/u/im_peterj)\
**Post date:** [May 22, 2026, 4:59pm UTC](https://discuss.ai.google.dev/t/image-understanding-and-segmentation-mask-support/146559/3 "2026-05-22T16:59:16Z")

</div>

Gemini Robotics-ER 1.6 and Gemini 2.5 Flash produce different types of segmentation masks.

Gemini Robotics-ER 1.6 is producing segmentation masks as a polygon of [x,y] coordinates. This is the same type of mask that Gemini 3.5 Flash creates.

Should Gemini 2.5 Flash still be expected to produce segmentation masks as a base64 png probability map? At the moment, Gemini 2.5 Flash is giving me segmentation masks in the form of a string (looks like “\<start\_of\_mask\>\<seg\_4\>”) that can not be interpreted as a usable mask.

---

<div class="post-metadata">

**Author:** ![todteera](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/todteera/32/24145_2.png) [@todteera](https://discuss.ai.google.dev/u/todteera)\
**Post date:** [May 25, 2026, 5:26pm UTC](https://discuss.ai.google.dev/t/image-understanding-and-segmentation-mask-support/146559/4 "2026-05-25T17:26:17Z")

</div>

+1 I’m running into the exact same issues. The masks generated by Gemini 2.5 Flash are unusuable.

---

<div class="post-metadata">

**Author:** ![Brendan\_Robert](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/brendan_robert/32/31648_2.png) [@Brendan\_Robert](https://discuss.ai.google.dev/u/Brendan_Robert)\
**Post date:** [May 27, 2026, 3:15am UTC](https://discuss.ai.google.dev/t/image-understanding-and-segmentation-mask-support/146559/5 "2026-05-27T03:15:12Z")

</div>

Would be also interested to know if segmentation masks are abandoned for the future models and if this feature should be hence avoided for long term usage ?

---

<div class="post-metadata">

**Author:** ![system](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/system/32/1_2.png) [@system](https://discuss.ai.google.dev/u/system)\
**Post date:** [November 5, 2026, 6:40pm UTC](https://discuss.ai.google.dev/t/image-understanding-and-segmentation-mask-support/146559/6 "2026-11-05T18:40:39Z")

</div>

Closed on November 5, 2026, 6:40pm UTC

This thread was automatically closed 60 days after the last reply. If you are running into an issue, please create a new post.
