CaptureImage vs CaptureCompressedImage

Class library usage, coding and language questions.
User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

CaptureImage vs CaptureCompressedImage

Post by artur_gadomski » Mon Sep 10, 2012 8:27 am

Hi
Is there a difference in CaptureImage and CaptureCompressedImage? I have tried following code:
Bitmap img = Imaging.CaptureImage(Host.Local);
img.Save(@"C:\Uncompressed.bmp");

Bitmap img2 = Imaging.CaptureCompressedImage(Host.Local);
img2.Save(@"C:\compressed.png");
            
Bitmap b = Host.Local.CaptureCompressedImage();
b.Save(@"C:\OtherCompressed.png");
And all files have the same size. Am I using the methods wrong or is there a bug in Ranorex?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: CaptureImage vs CaptureCompressedImage

Post by Support Team » Tue Sep 11, 2012 10:06 am

Hi,

Yes there is a difference. Although the difference in size appears only during runtime.
To get a compressed image during runtime you have to use a CompressedImage object instead of an Bitmap object. After saving or storing the image or compressed image,respectively, they have the same size (provided that you do not specify another ImageFormat than PNG as second argument to the Bitmap.Save method).

Kind Regards,
Larissa
Ranorex Support Team
.
Image