Image
Note
PIL images are read and written using the PIL library under-the-hood. Tensor images are manipulated using the PyTorch library.
stegobox.io.image.read(filename)
Read a PIL image from a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
The name or path to the image file. |
required |
Returns:
Type | Description |
---|---|
Image
|
A PIL image. |
stegobox.io.image.write(image, filename, format=None, **args)
Saves a PIL image to the designated file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
Image
|
The PIL image to save. |
required |
filename |
str
|
The name or path of the image file. |
required |
format |
Optional[str]
|
The format of the image - determined by the filename extension if not specified. Defaults to None. |
None
|
Source code in stegobox/io/image.py
stegobox.io.image.write_tensor(image, filename, format=None, **args)
Saves a torch.Tensor image to the designated file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
Tensor
|
The torch.Tensor image to save. |
required |
filename |
str
|
The name or path of the image file. |
required |
format |
Optional[str]
|
The format of the image - determined by the filename extension if not specified. Defaults to None. |
None
|
Source code in stegobox/io/image.py
Tip
You wouldn't normally read a tensor directly, in case you are wondering where is io.image.read_tensor
.