Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image capture format
#1
At present, many softwares do not have standard controls and cannot use the functions of QM's search controls. Therefore, using image capture and recognition functions has become the preferred solution.

But I have encountered a problem, the image format of the interception is BMP. If my screen resolution is very high and the captured images are many, the generated exe file is very large.

Is it possible to save the captured image as PNG?  This  can reduce the size of the exe file, is this possible?

Any suggestions are welcome, thanks in advance
#2
What exactly are you talking about ? Not following what qm function your talking about?
#3
Oh, look below

If add an option in the follow dialog, I can choose png format, it is much better.


Attached Files Image(s)
   
#4
qm2 development has stopped only bug fixes are addressed
 will need to make your own capture function and then click use existing...

for example use something like this

Function CaptureImageSaveAsPng
Code:
Copy      Help
RECT r
__GdiHandle hb
if(!CaptureImageOrColor(hb 0 _hwndqm "" r)) ret
mkdir "QM_CaptureImages" "$desktop$";;create folder if it doesnt exist to save images in
str sFolderName = "$desktop$\QM_CaptureImages\"
str sFileName.timeformat("{yyyy-MM-dd}_{HH-mm-ss}_QmCapture");;unique filename to avoid problems
str sFormat = ".png";;i use png for smaller filesize
str sFile.format("%s%s%s" sFolderName sFileName sFormat)
;save image
#compile "__Gdip"
GdipBitmap im
if(!im.FromHBITMAP(hb)) end "error"
if(!im.Save(sFile)) end "error"
out sFile
#5
Maybe my request is not clear enough,

Using the above dialog box, after the screenshot, the default will be added to the resource use bmp format. If there are a lot of screenshots, the generated exe will be very large, the process automatic software RPA, the dependence on the screenshot is very large, so I proposed the above request


Attached Files Image(s)
   
#6
as i said above Qm2 development has stopped. You can however use png images in find


as a workaround use your own capture function instead of the one built into qm find dialog and then on find dialog click the use existing button.
#7
I don't quite understand what you mean, can I add PNG checkboxes myself? is it possible?
#8
no 

find dialog only captures bitmaps only

you will need to use a different capture function than the 1 built into find image dialog

You could add a toolbar to the window to launch the function easier

but would still need add as a resource the newly captured png image

   


example code

Toolbar Toolbar1
Trigger !a"Find Image" "#32770" /QM     Help - how to add the trigger to the macro
Code:
Copy      Help
;/mov 190 115 /siz 85 21 /isiz 0 0 /bsiz 87 /set 1|2|32|0x4000 /transp "" b
Capture Png :mac "CaptureImageSaveAsPng"

Function CaptureImageSaveAsPng
Code:
Copy      Help
RECT r
__GdiHandle hb
if(!CaptureImageOrColor(hb 0 _hwndqm "" r)) ret
mkdir "QM_CaptureImages" "$desktop$";;create folder if it doesnt exist to save images in
str sFolderName = "$desktop$\QM_CaptureImages\"
str sFileName.timeformat("{yyyy-MM-dd}_{HH-mm-ss}_QmCapture");;unique filename to avoid problems
str sFormat = ".png";;i use png for smaller filesize
str sFile.format("%s%s%s" sFolderName sFileName sFormat)
;save image
#compile "__Gdip"
GdipBitmap im
if(!im.FromHBITMAP(hb)) end "error"
if(!im.Save(sFile)) end "error"
out sFile
0.2
int w=win("Find Image" "#32770")
int c=id(5 w) ;;push button 'Use existing...'
but+ c
#9
Thank you for your help, this method is good.  Smile

I think maybe some code is needed.
1. Add to resources
2. Displayed in the edit box
I feel this is too difficult.


Attached Files Image(s)
   
#10
no the edit control is for the filename when you use the capture button
#11
I don't understand why the bmp image format is used by default.

Because the recognition accuracy is high?

Add code after the custom capture function
1. Add to the resource first
2. Then set the name of the picture in the edit box.
is it possible?
#12
bmp in QM2 is used because when the scan function was introduced, Windows did not have any API to open png files. They added GDI+ in XP.

In macro resources the bmp are compressed. Then in exe too.
#13
Thank you for your explanation, I understand a lot  Smile


Forum Jump:


Users browsing this thread: 1 Guest(s)