Search code examples
fileplotexportpngoxyplot

Why does OxyPlot.PngExporter.Export not export a .png file


I try to export an Oxyplot PlotModel to .png

I tried like so:

Stream stream = File.Create(path);
var pngExporter = new PngExporter { Width = 600, Height = 400, Background = OxyColors.White };
PngExporter.Export(this.PlotModel, stream, 800, 600);

The output file is a .File type.

enter image description here


Solution

  • If the file extension is .File, it means the file is missing *.png and is therefore not readable by windows. You could try adding the file extension like this Stream stream = File.Create(path+ ".png");