ImageFile
ImageFile is inherited from File with additional methods for working with image files.
ImageFile is generated when a DataChain is created from storage, using type="image" param:
ImageFile
Bases: File
DataModel for reading image files.
Source code in datachain/lib/file.py
get_info
get_info() -> Image
Retrieves metadata and information about the image file.
Returns:
-
Image(Image) βA Model containing image metadata such as width, height and format.
Source code in datachain/lib/file.py
read
save
save(
destination: str,
format: str | None = None,
client_config: dict | None = None,
*,
content_type: str | None = None,
content_disposition: str | None = None,
cache_control: str | None = None,
content_encoding: str | None = None,
metadata: dict[str, str] | None = None,
write_options: dict[str, Any] | None = None
) -> ImageFile
Save the image to destination, optionally re-encoding to format.
If destination is a remote path, the image will be uploaded to
remote storage. See :meth:File.save for full destination semantics
and the object-metadata keyword arguments.
Source code in datachain/lib/file.py
Image
Bases: DataModel
A data model representing metadata for an image file.
Attributes:
-
width(int) βThe width of the image in pixels. Defaults to -1 if unknown.
-
height(int) βThe height of the image in pixels. Defaults to -1 if unknown.
-
format(str) βThe format of the image file (e.g., 'jpg', 'png'). Defaults to an empty string.