CustomImageSavingArgs class

CustomImageSavingArgs class

Provides information and controls for saving a single image during document-to-Markdown conversion.

An instance of this class is passed to the callback registered with CustomImagesStrategy for each image found in the source document.

Use CustomImageSavingArgs.set_output_image_file_name to change the file name the image is saved under, or CustomImageSavingArgs.set_output_stream to redirect the image data to a custom stream. If neither method is called, the library uses the defaults provided by CustomImageSavingArgs.image_file_name and CustomImageSavingArgs.output_directory.

The CustomImageSavingArgs type exposes the following members:

Methods

Method Description
set_output_image_file_name Overrides the default file name for this image. The image will be saved under the specified name instead of the library-generated CustomImageSavingArgs.image_file_name.
set_output_stream Redirects the image data to a custom writable stream instead of the default file output. The library will write the image bytes to this stream during conversion.
set_replacement_image Provides a replacement image to use instead of the original image from the source document. The stream must contain the complete replacement image data (e.g., PNG or JPEG bytes). When set, the library writes this data to the output instead of the original image.

Properties

Property Description
image_file_name The default file name (without path) suggested by the library for this image.
image_file_name_output The overridden file name set by CustomImageSavingArgs.set_output_image_file_name, or None if no override was specified.
output_directory The output directory where images are being saved.
output_stream The custom output stream set by CustomImageSavingArgs.set_output_stream, or None if no custom stream was specified.
replacement_image_stream The replacement image stream set by CustomImageSavingArgs.set_replacement_image, or None if no replacement was specified.
shape_type The type of the shape that contains the image in the source document (e.g., “Picture” or “Shape”).

See Also