getRectImage

Returns image of the specified area of the browser window.

Syntax

getRectImage = function(aLeft, aTop, aRight, aBottom);
 
getRectImage = function(aRect);

Parameters

  • aLeft
    • functions: X coordinate of the upper-left corner of the rectangular area relative to browser window
  • aTop
    • functions: Y coordinate of the upper-left corner of the rectangular area relative to browser window
  • aRight
    • functions: X coordinate of the lower-right corner of the rectangular area relative to browser window
  • aBottom
    • functions: Y coordinate of the lower-right corner of the rectangular area relative to browser window
  • aRect
    • functions: rectangle, area of which has to be obtained in the image

Returned value

  • functions: image of the specified area

Examples

  1. //Load a page with image (in this case - captcha)
    loadURI('http://www.google.com/recaptcha/learnmore');
    //Get an element, containing the image
    var imageElement = getElement('img',0,['src'],['google.com/recaptcha/']);
    //Get an element rectangle
    var imageRect = getElementRect(imageElement);
    //Get the image of the rectangle area
    var image = getRectImage(imageRect);
    //Deduce to the log  the color of image pixel  with coordinates (10,10)
    log(image.pixels[10][10]);