Method Save
Save(string, ImageOutputFormat, ImageEncoderOptions)
Saves the image to filePath as format, creating
the directory when needed. The extension of the path is not consulted: the caller
names the format, the path is where the bytes go.
public bool Save(string filePath, ImageOutputFormat format, ImageBuffer.ImageEncoderOptions options = null)
Parameters
filePathstringformatImageOutputFormatoptionsImageBuffer.ImageEncoderOptions
Returns
- bool
truewhen the file was written;falsewhen the file could not be opened.
Exceptions
- ArgumentException
The format cannot hold what the options ask for.
Save(string, ImageEncoderOptions)
Saves the image to filePath, picking the format from the file
extension through the toolkit's one format table (.jpg, .jpeg,
.png, .webp, .tif, .tiff, .bmp, .tga,
.pnm / .ppm / .pgm / .pbm). An extension of a format the
toolkit does not encode, or no extension, is refused - never silently written as
another format under a misleading name.
public bool Save(string filePath, ImageBuffer.ImageEncoderOptions options = null)
Parameters
filePathstringoptionsImageBuffer.ImageEncoderOptions
Returns
- bool
truewhen the file was written;falsewhen the file could not be opened.
Examples
using ImageBuffer image = ImageBuffer.Load("scan.png");
image.Save("scan.tif", new ImageBuffer.ImageEncoderOptions { TiffCompression = TiffCompression.Deflate });
Exceptions
- ArgumentException
The extension names no encodable format.