ISCC - Image Processing#
Image handling module.
image_normalize(img)
#
Normalize image for hash calculation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img
|
Pillow Image Object |
required |
Returns:
Type | Description |
---|---|
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
|
Pillow Image Object |
required |
Returns:
Type | Description |
---|---|
EXIF transposed image |
image_fill_transparency(img)
#
Add white background to image if it has alpha transparency.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img
|
Pillow Image Object |
required |
Returns:
Type | Description |
---|---|
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
|
Pillow Image Object |
required |
Returns:
Type | Description |
---|---|
Image with uniform colored (empty) border removed. |
image_meta_extract(fp)
#
Extract metadata from image using native exiv2 bindings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp
|
Filepath to image file. |
required |
Returns:
Type | Description |
---|---|
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
|
Filepath to source image file |
required | |
meta
|
Metadata to embed into image |
required |
Returns:
Type | Description |
---|---|
Filepath to the new image file with updated metadata |
image_meta_delete(fp)
#
Delete all metadata from image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp
|
Filepath to image file. |
required |
image_thumbnail(fp)
#
Create a thumbnail for an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp
|
Filepath to image file. |
required |
Returns:
Type | Description |
---|---|
Thumbnail image as PIL Image object |
image_strip_metadata(img)
#
Strip all metadata from Pillow Image object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img
|
PIL Image object to strip metadata from. |
required |
Returns:
Type | Description |
---|---|
Image.Image |
image_to_data_url(img)
#
Convert PIL Image object to WebP Data-URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img
|
PIL Image object to encode as WebP Data-URL. |
required |
Returns:
Type | Description |
---|---|
Data-URL string |