Image.SaveAsync

SaveAsync(string, ImageOptionsBase)

Saves the object’s data to the specified file location in the specified file format according to save options.

public virtual Task SaveAsync(string filePath, ImageOptionsBase options)
ParameterTypeDescription
filePathStringThe file path.
optionsImageOptionsBaseThe options.

Examples

Exports drawing to BMP with specified size

using (var image = Aspose.CAD.Image.Load("fileName.dwg"))
{
    await image.Save("targetFile.bmp", new BmpOptions()
    {
        VectorRasterizationOptions = new CadRasterizationOptions()
        {
            PageWidth = 640,
            PageHeight = 480
        }
    });
}

See Also


SaveAsync(Stream, ImageOptionsBase)

Saves the image’s data to the specified stream in the specified file format according to save options.

public Task SaveAsync(Stream stream, ImageOptionsBase optionsBase)
ParameterTypeDescription
streamStreamThe stream to save the image’s data to.
optionsBaseImageOptionsBaseThe save options.

Exceptions

exceptioncondition
ArgumentNullExceptionoptionsBase
ArgumentExceptionCannot save to the specified format as it is not supported at the moment.;optionsBase
ImageSaveExceptionImage export failed.

Examples

Exports drawing to JPEG format and rotate it by 90 degrees then writes to memory stream

using (var ms = new MemoryStream())
{
    using (var image = Aspose.CAD.Image.Load("fileName.dwg"))
    {
        await image.Save(ms, new JpegOptions()
        {
            Rotation = RotateFlipType.Rotate90FlipNone
        });
    }
}

See Also