Created
February 19, 2017 10:06
-
-
Save RickStrahl/5d7d2916fc2bff75c8b3a0d3ca6b463d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void BitmapWpfPngSaveTest() | |
{ | |
Assert.IsTrue(System.Windows.Clipboard.ContainsImage(), "No image on clipboard"); | |
string of = "c:\\temp\\test_Bitmap.png"; | |
var bmpSource = System.Windows.Clipboard.GetImage(); | |
using (var fileStream = new FileStream(of, FileMode.Create)) | |
{ | |
BitmapEncoder encoder = null; | |
encoder = new PngBitmapEncoder(); | |
encoder.Frames.Add(BitmapFrame.Create(bmpSource)); | |
encoder.Save(fileStream); | |
//if (ext == ".png") | |
// mmFileUtils.OptimizePngImage(sd.FileName,5); // async | |
} | |
Assert.IsTrue(File.Exists(of)); | |
ShellUtils.GoUrl(of); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment