1

Is there a way to save a screenshot to memory and then load it into an image control(wpf) without saving it to disk?

Screenshot ss = ((ITakesScreenshot)driver).GetScreenshot();
ss.SaveAsFile(@"C:\hello.bmp", OpenQA.Selenium.ScreenshotImageFormat.Bmp);

Thanks¡¡¡

Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92
mlago
  • 11
  • 2
  • Why not just open the file and read the `byte`s? – Greg Burghardt May 06 '20 at 11:23
  • 2
    The `Screenshot` class has a property called `AsByteArray` which returns the raw array of bytes for the image. You should be able to use that. – Greg Burghardt May 06 '20 at 11:26
  • Perfect, works well with `AsByteArray` and them [Convert byte array to image in wpf](https://stackoverflow.com/questions/9564174/convert-byte-array-to-image-in-wpf) – mlago May 06 '20 at 12:01

0 Answers0