Skip to content

Instantly share code, notes, and snippets.

@RickStrahl
Created February 19, 2017 09:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RickStrahl/bec525fcccf472d467326153b24bd114 to your computer and use it in GitHub Desktop.
Save RickStrahl/bec525fcccf472d467326153b24bd114 to your computer and use it in GitHub Desktop.
public void ImageSharpClipboardTest()
{
string of = "c:\\temp\\test_imagesharp.png";
Assert.IsTrue(Clipboard.ContainsImage(), "No image on clipboard");
var img = Clipboard.GetImage();
ImageConverter converter = new ImageConverter();
byte[] bytes = (byte[])converter.ConvertTo(img, typeof(byte[]));
var image = new Image(bytes);
image.Save(of);
Assert.IsTrue(File.Exists(of));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment