Skip to content

Commit

Permalink
docs(Images): add retrieving images examples (#64, #36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaoses-Ib committed Aug 1, 2024
1 parent 167cbd2 commit aa8d728
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions docs/Images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,75 @@ def SaveImage(
)
```

Retrieving the saved images:
```python
from PIL import Image

image = EmptyImage(512, 512, 1)
image = SaveImage(image, 'ComfyUI')

image_batch = image.wait()

# Get the first image
image: Image.Image = image_batch[0]

# Get all images in the batch
images: list[Image.Image] = image_batch.wait()
```
Or with `await`:
```python
from PIL import Image

image = EmptyImage(512, 512, 1)
image = SaveImage(image, 'ComfyUI')

image_batch = await image

# Get the first image
image: Image.Image = await image_batch.get(0)

# Get all images in the batch
images: list[Image.Image] = await image_batch
```

### To `temp` directory
```python
def PreviewImage(
images: Image
)
```

Retrieving the preview images:
```python
from PIL import Image

image = EmptyImage(512, 512, 1)
image = PreviewImage(image)

image_batch = image.wait()

# Get the first image
image: Image.Image = image_batch[0]

# Get all images in the batch
images: list[Image.Image] = image_batch.wait()
```
Or with `await`:
```python
from PIL import Image

image = EmptyImage(512, 512, 1)
image = PreviewImage(image)

image_batch = await image

# Get the first image
image: Image.Image = await image_batch.get(0)

# Get all images in the batch
images: list[Image.Image] = await image_batch
```

### [To client](https://github.com/Acly/comfyui-tooling-nodes)
```python
def ETNSendImageWebSocket(
Expand Down

0 comments on commit aa8d728

Please sign in to comment.