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: VToBMP

Previous Top Next


MiniRobotLanguage (MRL)

 

GRA.vToBMP Command

Convert Variable that contains an Image to the internal Bitmap-Format for use with ANA.-Commands

 

 

Intention

 

This Command is helpful, especially together with "ANA.#FromVar".

GRA.vbm  will convert the format of an image into the internal Bitmap-Format. The result will also be stored in a Variable.

This way you can use all Sorts of Images (see below) together with the ANA.-Commands, especially using "ANA.#FromVar".

 

 

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

 

BMP

EMF

JPG or JPEG

GIF

ICO

PNG

TIF or TIFF

WMF

 

 

If you specify P$ then you can also specify a new file-resolution in X-direction. The resolution in Y-direction will automatically be calculated in a way that the original Apect-Ratio is been preserved.

 

To convert a loaded .jpg  you could write:

 

' Load a JPG-File, here from "Inline-Data", see Inline Data Commands

GSB.GetPic

' Convert jpg to internal Bitmap Format

GRA.vbm|$$DTA|$$BMP|.jpg

' Use ANA.Command to directly load the Imagine int an Image Register

ANA.#FromVar|1|$$BMP

' Show the Image

ANA.Show|1!

ENR.

 

 

    This may also be necessary for several types of ".bmp"-Files that do not match the internal specifications of the "ANA.#FromVar" Command.

    In this case we just convert from ".bmp" to ".bmp" to be able to use the Picture.

 

' Load a JPG-File, here from "Inline-Data", see Inline Data Commands

GSB.GetPic

' Convert .bmp to internal Bitmap Format

GRA.vbm|$$DTA|$$BMP|.bmp

' Use ANA.Command to directly load the Imagine int an Image Register

ANA.#FromVar|1|$$BMP

' Show the Image

ANA.Show|1!

ENR.

 

   
   Stack Usage / Return values:
 
   This GRA.-Operation will leave several values on the stack, depending on the success of the Operation.

   Most Important is the most upper value that is a "0" if the Operation was successful.

 

clip0079

 

Internally used temporary files will automatically be deleted.

 

 

Syntax

 

GRA.vbm|P1|P2[|P3][|P4]

GRA.vToBMP|P1|P2[|P3][|P4]

 

 

Parameter Explanation

 

P1 - Source file data inside a variable. Can be from Inline-Data, or you can load a picture using CFF.-Command.

 

P2  - Destination Variable. This Variable will receive the Data that can be used together with ANA.#FromVar
 

 

P3 - Filetype of P1-Data. Like ".bmp",".png",".jpg"

 

P4 - X-Resolution of new Image. Y-Resolution is automatically choosen using the Aspect-ratio of the Original Image.
    If parameter is omitted, Original Image Resolution is taken.

    Here you can specify the following 2 additional Parameters:

    # - This will allow to upscale pictures to a higher resolution. If omitted, the maximum resolution is the Original resolution.

    @ - This will force the Process to keep the original resolution of the Source file

 

 

 

 

Example

 

'################################

' GRA.vbm-Sample

'################################

CFF.Mypicture.jpg|$$DTA

GRA.vbm|$$DTA|$$BMP|.bmp

ANA.#FromVar|1|$$BMP

ANA.Show|1!

ENR.

 

 

 

Remarks

 

-

 

 

 

Limitations:

A Quadratic Image should be upscaled up to about 26000 Pixels X/Y-Size that is 676 MegPixel.
Larger sizes may work or fail, depending on the Memory Situation in Windows.

 

 

 

See also:

 

    1.8. Selecting the Application (Topwindow)

    IPC. / NPC. - If-Pixel-Colour

    GPC. - Get-Pixel-Colour