image_content Module
Classes
| ImageContent |
Image Content class. This can be created either the bytes data or a data uri, additionally it can have a uri. The uri is a reference to the source, and might or might not point to the same thing as the data. Use the .from_image_file method to create an instance from a image file. This reads the file and guesses the mime_type. If both data_uri and data is provided, data will be used and a warning is logged. Args: uri (Url | None): The reference uri of the content. data_uri (DataUrl | None): The data uri of the content. data (str | bytes | None): The data of the content. data_format (str | None): The format of the data (e.g. base64). mime_type (str | None): The mime type of the image, only used with data. kwargs (Any): Any additional arguments:
Methods: from_image_path: Create an instance from an image file. str: Returns the string representation of the image. Raises: ValidationError: If neither uri or data is provided. Note: This class is marked as 'experimental' and may change in the future. Create an Image Content object, either from a data_uri or data. |