Profile Picture

How To: Save to Bitmap Programatically

Posted By Ashley Davy 3 Years Ago
Author
Message
Ashley Davy
Question Posted 3 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 36, Visits: 119
I have the following code which exports to a PNG format.  I want to export to Bitmap but I cannot find the NBitmapEncoderSettings class to reference.  How can I use the coding method below to export to a bitmap?

// Configure the decoder
    NPngEncoderSettings ImgPngEncoder = new NPngEncoderSettings();
    ImgPngEncoder.ColorType = ENPngColorType.TrueColorWithAlpha;
    ImgPngEncoder.CompressionLevel = Nevron.Nov.Compression.ENCompressionLevel.BestCompression;

    // Export To Stream
    NDrawingRasterImageExporter ImgRasterExporter = new Nevron.Nov.Diagram.Export.NDrawingRasterImageExporter((Nevron.Nov.Diagram.NDrawingDocument)DrawNOV.View.Content.OwnerDocument);
    ImgRasterExporter.SaveToStream(MemStrPng, ImgRasterExporter.GetDocumentContentBounds(), 300, NImageFormat.Png, ImgPngEncoder);

    MemStrPng.Position = 0;

    // Save To file
    MemStrPng.WriteTo(new FileStream(@"C:\AD_ATF\AD15.png", FileMode.Create));


Nevron Support
Posted 7 Months Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 15 hours ago
Posts: 3,054, Visits: 4,018
To export the active page of a drawing to a bitmap (BMP) file, you can use the following code:


NDrawingRasterImageExporter imageExporter = new NDrawingRasterImageExporter(drawingView.Content);
using (Stream stream = File.Create(@"C:\ExportedImage.bmp"))
{
  imageExporter.SaveToStream(stream, NImageFormat.Bmp);
}


For more information on raster image exports of NOV Diagram, please take a look at the following documentation topic:
Drawing Raster Image Export


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic