Skip to content

Commit 2d3afa6

Browse files
authored
DOCS-2949: QA camera (#3520)
1 parent 22773b5 commit 2d3afa6

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

docs/appendix/changelog.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ You can use the helper functions `viam_to_pil_image` and `pil_to_viam_image` pro
105105
{{< expand "Click for an example of using the ViamImage -> PIL Image helper functions." >}}
106106

107107
```python {class="line-numbers linkable-line-numbers"}
108-
# from viam.media.utils.pil import pil_to_viam_image, viam_to_pil_image
109-
# < ADD ABOVE IMPORT TO BEGINNING OF PROGRAM >
108+
from viam.media.utils.pil import pil_to_viam_image, viam_to_pil_image
110109

111110
# Get the ViamImage from your camera.
112111
frame = await my_camera.get_image()

static/include/components/apis/generated/camera.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ In addition, the Python SDK provides the helper functions `viam_to_pil_image` an
3737
For example:
3838

3939
```python {class="line-numbers linkable-line-numbers"}
40-
# from viam.media.utils.pil import pil_to_viam_image, viam_to_pil_image
41-
# < ADD ABOVE IMPORT TO BEGINNING OF PROGRAM >
40+
from viam.media.utils.pil import pil_to_viam_image, viam_to_pil_image
4241

4342
# Get the ViamImage from your camera.
4443
frame = await my_camera.get_image()
@@ -52,7 +51,7 @@ x, y = pil_frame.size[0], pil_frame.size[1]
5251
cropped_pil_frame = pil_frame.crop((0, 0, x / 2.5, y))
5352

5453
# Convert back to ViamImage.
55-
cropped_frame = pil_to_viam_image(cropped_pil_frame)
54+
cropped_frame = pil_to_viam_image(cropped_pil_frame, frame.mime_type)
5655
```
5756

5857
{{% alert title="Tip" color="tip" %}}

static/include/components/apis/overrides/methods/python.camera.get_image.after.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ In addition, the Python SDK provides the helper functions `viam_to_pil_image` an
55
For example:
66

77
```python {class="line-numbers linkable-line-numbers"}
8-
# from viam.media.utils.pil import pil_to_viam_image, viam_to_pil_image
9-
# < ADD ABOVE IMPORT TO BEGINNING OF PROGRAM >
8+
from viam.media.utils.pil import pil_to_viam_image, viam_to_pil_image
109

1110
# Get the ViamImage from your camera.
1211
frame = await my_camera.get_image()
@@ -20,7 +19,7 @@ x, y = pil_frame.size[0], pil_frame.size[1]
2019
cropped_pil_frame = pil_frame.crop((0, 0, x / 2.5, y))
2120

2221
# Convert back to ViamImage.
23-
cropped_frame = pil_to_viam_image(cropped_pil_frame)
22+
cropped_frame = pil_to_viam_image(cropped_pil_frame, frame.mime_type)
2423
```
2524

2625
{{% alert title="Tip" color="tip" %}}

0 commit comments

Comments
 (0)