FileSaver.SaveBitmapAndLinkInEditor

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

Parameters

bitmap
The bitmap to save

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

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

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

noEditorEmbedding

Remarks

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


See also:

Class FileSaver

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