ISCC - Image Processing#
Image handling module.
image_normalize(img)
#
Normalize image for hash calculation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img |
Image.Image
|
Pillow Image Object |
required |
Returns:
Type | Description |
---|---|
Sequence[int]
|
Normalized and flattened image as 1024-pixel array (from 32x32 gray pixels) |
image_exif_transpose(img)
#
Transpose image according to EXIF Orientation tag
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img |
Image.Image
|
Pillow Image Object |
required |
Returns:
Type | Description |
---|---|
Image.Image
|
EXIF transposed image |
image_fill_transparency(img)
#
Add white background to image if it has alpha transparency.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img |
Image.Image
|
Pillow Image Object |
required |
Returns:
Type | Description |
---|---|
Image.Image
|
Image with transparency replaced by white background |
image_trim_border(img)
#
Trim uniform colored (empty) border.
Takes the upper left pixel as reference for border color.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img |
Image.Image
|
Pillow Image Object |
required |
Returns:
Type | Description |
---|---|
Image.Image
|
Image with uniform colored (empty) border removed. |
image_meta_extract(fp)
#
Extract metadata from image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp |
str
|
Filepath to image file. |
required |
Returns:
Type | Description |
---|---|
dict
|
Metadata mapped to IsccMeta schema |
image_meta_embed(fp, meta)
#
Embed metadata into a copy of the image file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp |
str
|
Filepath to source image file |
required |
meta |
IsccMeta
|
Metadata to embed into image |
required |
Returns:
Type | Description |
---|---|
str
|
Filepath to the new image file with updated metadata |
image_meta_delete(fp)
#
Delete all metadata from image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp |
str
|
Filepath to image file. |
required |
image_thumbnail(fp)
#
Create a thumbnail for an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp |
str
|
Filepath to image file. |
required |
Returns:
Type | Description |
---|---|
Image.Image
|
Thumbnail image as PIL Image object |
image_to_data_url(img)
#
Convert PIL Image object to WebP Data-URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img |
Image.Image
|
PIL Image object to encode as WebP Data-URL. |
required |
Returns:
Type | Description |
---|---|
str
|
Data-URL string |