Opened 14 years ago

Closed 14 years ago

#1446 closed Bug (Fixed)

_Screencapture_Capture UDF height and width is 1 pixel off

Reported by: djbarnes@… Owned by: Jon
Milestone: Component: AutoIt
Version: Severity: None
Keywords: screencapture Cc:


Screencapture_capture will return a square that is 1 pixel too small both in width and in height.

Imagine a grid of pixels 3x3. You want to capture pixel 1,1 - 3,3.
so you run the command:
_ScreenCapture_Capture ("example.png",1,1,3,3)
however, in _ScreenCapture_Capture the following code exists:

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

so $iW = 3-1 = 2

$iH = 3-1 = 2

returning an image 2x2, which isn't what you want. The rectangle is inclusive of the last pixels.

recommended fix:

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

Although this bug is minor, If you are doing pixelchecksum and using Screencapture_capture to test your code this can cause hours of headaches!

Attachments (0)

Change History (1)

comment:1 Changed 14 years ago by Jon

  • Milestone set to
  • Owner set to Jon
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [5671] in version:

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

as closed The owner will remain Jon.

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

Note: See TracTickets for help on using tickets.