Saves a bitmap image to file using a standard mechanism that prompts for a filename (unless you pass one in), optionally compresses the file and by default embeds a link at cursor position.

Overrides let you remove some of these tasks.

The method returns the embedded image path - a relative path if possible.

public static Task<String> SaveBitmapAndLinkInEditor(Bitmap bitmap,
	MarkdownDocumentEditor editor,
	string imageFilename,
	bool noImageCompression,
	bool noEditorEmbedding)

Return Value

relative image URL used for embedding


The bitmap to save

An instance of the editor to paste into. If not passed the open document is used.

Optional image filename. If not passed you are prompted using MM's default locations (last document location, project/folder root/current directory)

Images are compressed by default, set to true to avoid compression. Uses Pingo compressor for max size reduction.



Make sure you .Dispose() the bitmap to avoid big memory leaks

See also:

Class FileSaver

© West Wind Technologies, 2016-2023 • Updated: 11/23/21
Comment or report problem with topic