ImageSearchOptions class

ImageSearchOptions class

Represents search options for Image signatures.

Learn more:

The ImageSearchOptions type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of the ImageSearchOptions class with default values.

Properties

Property Description
max_content_size The maximum size of images for the search criteria, in bytes.
min_content_size The minimal size of image data, in bytes, to be considered during a search. A non‑zero value specifies the minimal size; the default is zero, which does not affect the search result.
return_content The flag that determines whether the image content of a signature is returned.
return_content_type The file type of the returned image content when the return_content property is enabled.
all_pages The flag indicating whether to search on each document page. By default this value is True. (inherited from SearchOptions)
page_number The document page number for searching (optional). (inherited from SearchOptions)
pages_setup The options to specify pages for signature searching. (inherited from SearchOptions)
shape_position The flag indicating whether to return the shape position in the document layout. Available only for Word documents. (inherited from SearchOptions)
skip_external The flag to return only signatures marked as IsSignature. By default the value is False, which indicates that all signatures matching the specified criteria are returned. (inherited from SearchOptions)

Example

from groupdocs.signature import Signature
from groupdocs.signature.options import ImageSearchOptions

def extract_image_signatures():
    with Signature("signed.pdf") as signature:
        options = ImageSearchOptions()
        options.all_pages = False          # search the first page only
        options.page_number = 1
        options.min_content_size = 1024   # skip images smaller than 1 KB
        options.return_content = True
        options.return_content_type = FileType.PNG

        result = signature.search([options])
        for i, image in enumerate(result.signatures, start=1):
            file_name = f"image_signature_{i}.png"
            with open(file_name, "wb") as out:
                out.write(image.content)

See Also