Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > GRA. - Picture/Image Commands >

Image/Pixel-Color Operations

GRA. - Graphic Command: GetResolution

Previous Top Next


MiniRobotLanguage (MRL)

 

GRA.GetResolution Command

Get Image X- and Y-Resolution

 

 

Intention

 

GRA.get  will compute the X- and Y-Resolution of an Image in Pixels.

 

The following file-Types can be specified as Source file:

 

BMP

EMF

JPG or JPEG

GIF

ICO

PNG

TIF or TIFF

WMF

 

Usage is as simple as:

 
$$FIL=?desktop\MyPic.BMP

' $$XRE will get the X-Resolution, $$YRE will get the Y-Resolution

GRA.get|$$FIL|$$XRE|$$YRE

MBX.Resolutiuon is: $$XRE,$$YRE

 

 

   
   Stack Usage / Return values:
 
    Any GRA.-Operation will leave one or more values on the stack, depending on the success of the Operation.

   Generally if there is a "0" on TOS then the Operation was successful. If you do not specify the Variables for the X- and Y-Resolution,

   these values will be placed on the Stack also.

 

VAR.$$SRC=?path\DSC01987.JPG

STV.TOVCLEAR|$$DUM

GRA.get|$$SRC

DMP.6

MBX.!

ENR.

 

 

  GRA_Get

 

 

 

Here is an explanation of the stack values:

 

Position:      Explanation:

  0 (TOS)  Is 0 if the GRA.-Operation was successful. Any other value may indicate an error: 1 - Filename or Path Error. 2 - Parameter - Error.

  1      Y-Resolution

  2      X-Resolution

 

In case you specify only one of the two variables, the other value will be placed on the Stack.

 

 

 

 

Syntax

 

GRA.get|P1[|P2][|P3]

GRA.GetResolution|P1[|P2][|P3]

 

 

Parameter Explanation

 

P1 - Source file.

 

P2  - Variable for X-Resolution (Out). If this variable is omitted or -, the value is placed on the Stack.
   

P3 - Variable for Y-Resolution (Out). If this variable is omitted or -, the value is placed on the Stack.
     

Example:

  GRA.get|?desktop\MyFile.BMP|$$XRE|$$YRE

 

     ' have the Y-Resolution on the Stack

  GRA.get|$$FIL|$$XRE

 

     ' have the X-Resolution on the Stack

  GRA.get|$$FIL|-|$$YRE

 

See above which values are placed on the Stack during the Operation.

 

 

 

 

Example

 

VAR.$$SRC=?path\DSC01987.JPG

' Folgende Zeile löscht den Stack.

STV.TOVCLEAR|$$DUM

' Hier gehts los

GRA.get|$$SRC|$$YRE|$$XRE

' Diese Zeile zeigt den Stack an

DMP.6

MBX.$$XRE-$$YRE

ENR.

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

 

 

See also:

 

    1.8. Selecting the Application (Topwindow)

    IPC. / NPC. - If-Pixel-Colour

    GPC. - Get-Pixel-Colour