Modify

Opened 12 years ago

Closed 12 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 Changed 12 years ago by Melba23

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 Changed 12 years ago by guinness

  • Resolution set to Duplicate
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.