graviti.file.image_size
#
Functions to get image size.
Module Contents#
Classes#
The base class for different image formats. |
|
The class for JPEG image format. |
|
The class for PNG image format. |
|
The class for an older version of PNG image format. |
|
The class for GIF image format. |
|
The class for JPEG 2000 image format. |
|
The class for BMP image format. |
|
The class for TIFF image format. |
|
The class for ICO image format. |
|
The class for WebP image format. |
|
The class for Flif image format. |
Functions#
|
Get the height and width of the input image file. |
Attributes#
- graviti.file.image_size.get_image_size(path)[source]#
Get the height and width of the input image file.
- Parameters
path (pathlib.Path) – The path of the image.
- Returns
The height and width of the input image.
- Return type
Tuple[int, int]
- class graviti.file.image_size.ImageFormatBase[source]#
The base class for different image formats.
- classmethod check(cls, header, size)[source]#
Check if the input header fits the current image format.
- Parameters
header (bytes) – The header of the image.
size (int) – The size of the image.
- Returns
Whether if the input header fits the current image format.
- Return type
bool
- classmethod get_image_size(cls, header, fp)[source]#
Get the height and width through the input data.
- Parameters
header (bytes) – The header of the image or the entire image.
fp (_io.BufferedReader) – The image file pointer.
- Returns
The height and width of the image.
- Raises
ImageDecodeError – When the input image file is invalid.
- Return type
Tuple[int, int]
- class graviti.file.image_size.JPEG[source]#
Bases:
ImageFormatBase
The class for JPEG image format.
- class graviti.file.image_size.PNG[source]#
Bases:
ImageFormatBase
The class for PNG image format.
- class graviti.file.image_size.OldPNG[source]#
Bases:
ImageFormatBase
The class for an older version of PNG image format.
- class graviti.file.image_size.GIF[source]#
Bases:
ImageFormatBase
The class for GIF image format.
- class graviti.file.image_size.JPEG2000[source]#
Bases:
ImageFormatBase
The class for JPEG 2000 image format.
- class graviti.file.image_size.BMP[source]#
Bases:
ImageFormatBase
The class for BMP image format.
- class graviti.file.image_size.TIFF[source]#
Bases:
ImageFormatBase
The class for TIFF image format.
- class graviti.file.image_size.ICO[source]#
Bases:
ImageFormatBase
The class for ICO image format.
- class graviti.file.image_size.WebP[source]#
Bases:
ImageFormatBase
The class for WebP image format.
- class graviti.file.image_size.FLIF[source]#
Bases:
ImageFormatBase
The class for Flif image format.