Modify

Opened 13 years ago

Closed 13 years ago

#2329 closed Bug (Duplicate)

_ScreenCapture_Capture Wrong output size

Reported by: johnmcloud Owned by:
Milestone: Component: AutoIt
Version: 3.3.8.1 Severity: None
Keywords: Cc:

Description

The finale image has 1 pixel more then the real desktop size, so if the desktop is 1024-768, the image is 1025x769

Example:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>

$hGUI = GUICreate("", 200, 200, -1, -1)
$Button = GUICtrlCreateButton("Click", 64, 80, 105, 41)
GUISetState(@SW_SHOW)
While 1
 $nMsg = GUIGetMsg()
 Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button
   _ScreenCapture_Capture(@ScriptDir & "\Test_1.jpg", 0, 0, -1, -1, True)
   $hJpg = _ScreenCapture_Capture("")
   _ScreenCapture_SaveImage(@ScriptDir & "\Test_2.jpg", $hJpg)
 EndSwitch
WEnd

The solution can be, on the UDF:

Local $iW = ($iRight - $iLeft) + 1
Local $iH = ($iBottom - $iTop) + 1

To

Local $iW = ($iRight - $iLeft)
Local $iH = ($iBottom - $iTop)

But i'm not an expert, so please check it out.
Thanks

Attachments (0)

Change History (3)

comment:1 by Melba23, 13 years ago

The suggested solution is flawed as it will result in all other screen captures being 1 pixel too small (0 to 100 is 101 pixels not 100).

What would solve the problem is to adjust the values of screen width and height derived when $iRight/$iBottom are set to -1:

If $iRight = -1 Then $iRight = _WinAPI_GetSystemMetrics($__SCREENCAPTURECONSTANT_SM_CXSCREEN) - 1
If $iBottom = -1 Then $iBottom = _WinAPI_GetSystemMetrics($__SCREENCAPTURECONSTANT_SM_CYSCREEN) - 1

That way the correct width and height values will be set in all cases when the capture size parameters are calulated with:

Local $iW = ($iRight - $iLeft) + 1
Local $iH = ($iBottom - $iTop) + 1

M23

comment:3 by guinness, 13 years ago

Resolution: Duplicate
Status: newclosed

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.