ISCC - EPUB Processing#
EPUB handling module.
epub_thumbnail(fp)
#
Creat thumbnail from EPUB document cover image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp
|
Filepath to EPUB document. |
required |
Returns:
Type | Description |
---|---|
Thumbnail image as PIL Image object |
epub_meta_embed(fp, meta)
#
Embed metadata into a copy of the EPUB file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp
|
Filepath to source EPUB file |
required | |
meta
|
IsccMeta
|
Metadata to embed into EPUB |
required |
Returns:
Type | Description |
---|---|
Filepath to the new EPUB file with updated metadata |
epub_cover(fp)
#
Extract the cover image bytes from an EPUB file.
This function attempts to locate the cover image by first checking the metadata cover reference, then falling back to scanning for image files with 'cover' in the name and if that fails it returns the first image file from the manifest. The function also logs the relative path to the image within the epub which was identified as cover image. If no image is found, it raises an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp
|
Filepath to EPUB file |
required |
Returns:
Type | Description |
---|---|
Raw bytes of the cover image |
Raises:
Type | Description |
---|---|
IsccExtractionError
|
If no cover image can be found. |