ImageFormat
ClassEnumSource
ImageFormat.png = "png"
ImageFormat.jpeg = "jpeg"
ImageFormat.webp = "webp"
ImageFormat.webp_lossless = "webp_lossless"
The image file format.
This format is only used when saving the images to files.
Enums
| Name | Type | Value |
|---|---|---|
png | str | "png" |
jpeg | str | "jpeg" |
webp | str | "webp" |
webp_lossless | str | "webp_lossless" |
Methods
from_str
v_1: Self = ImageFormat.from_str(val: str | Self)
Use a str to define this size.
Requires
| Name | Type | Required | |
|---|---|---|---|
val | str | Self | Should be a file name extension without the staring dot. For example |
Returns
| Name | Type | |
|---|---|---|
v_1 | Self | The converted format enum object. |
from_img
v_1: Self = ImageFormat.from_img(img: Image)
Get the appropriate image format by inferring from the image object.
Requires
| Name | Type | Required | |
|---|---|---|---|
img | Image | The PIL image object used to infer the format. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Self | The converted format enum object. |
as_fmt_str
v_1: str = self.as_fmt_str()
Convert this value as the format name that can be used in pillow.
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The format name converted from this enum object. |