How To: Save to Bitmap Programatically


Author
Message
Ashley Davy
Ashley Davy
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
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
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.1K
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


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic
1 active, 1 guest, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search