Screenshots as jpg

Ask general questions here.
mander95
Posts: 66
Joined: Tue Jun 21, 2016 7:35 pm

Screenshots as jpg

Post by mander95 » Tue Oct 11, 2016 8:16 pm

I saved the screenshots that I take with my automation as jpgs but when I try to read it on another computer, a Warning occurs where it states that the files were actually png files with jpg extensions. Is there a way to fix the way the files are saved.
Attachments
Test.rxrec
This is the test module where the code is implemented
(1.21 KiB) Downloaded 32 times
Test.UserCode.cs
This is where I'm implementing captureScreentshot()
(1.26 KiB) Downloaded 43 times
BaseTestCase.cs
This contain my custom function for capturing screenshots called captureScreenshot()
(46.72 KiB) Downloaded 45 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Screenshots as jpg

Post by odklizec » Wed Oct 12, 2016 8:03 am

Hi,

It seems the Bitmap.Save is a system drawing method, where default output format is PNG ;) What you need to do is to specify the target format date, like this:

Code: Select all

bitmap.Save(screenshotPath,System.Drawing.Imaging.ImageFormat.Jpeg);
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

mander95
Posts: 66
Joined: Tue Jun 21, 2016 7:35 pm

Re: Screenshots as jpg

Post by mander95 » Thu Oct 13, 2016 5:35 pm

it works, thank you :D :D :D :D :D :D

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Screenshots as jpg

Post by odklizec » Fri Oct 14, 2016 7:30 am

Nice to hear that ;) You are welcome.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration