Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Convert Colors >

Image/Pixel-Color Operations

ANA.BW - Convert IR to Black and White

Previous Top Next


MiniRobotLanguage (MRL)

 

ANA.BW

Convert an Image-Register (IR) to Black and White using an specified threshold

 

 

Intention

 

This command will convert the Content of an IR directly into an B/W Image using only 2 Colours: Black and White.

The difference between Black and White is made along a user specified threshold that can vary from 1 - all White - to 768 (all Black).

Using a value of 0 will internally use the optimum value of 383.

 

 

1. Capture Screenshot of open Browser and convert it to BW

You can do this with your own preferred window - just change the STW.

 

STW.ct|Chrome_WidgetWin_1|- Brave

ANA.Snap|0

ANA.Save|0|?path\Before.png

' If you use the value of "0", it will internally be used 383

ANA.bw|0|383

ANA.Save|0|?path\After.png

ENR.

 

 

BW0       BW3       BW1

 

Here you can see the picture before and after the operation, using the Threshhold of 383  and a threshold of 128.

 

 

 

 

2. Use BW with no Parameters

In this case the default values are taken, means "0" as the Source and Target IR, and &H17f (383 dec.) as threshold.

 

STW.ct|Chrome_WidgetWin_1|- Brave

ANA.Snap|0

ANA.Save|0|?path\Before.png

ANA.bw

ANA.Save|0|?path\After.png

ENR.

 

 

3. Making things darker

Here we use a threshold of 460.

 

STW.ct|Chrome_WidgetWin_1|- Brave

ANA.Snap|0

ANA.Save|0|?path\Before.png

ANA.bw|0|460

ANA.Save|0|?path\After.png

ENR.

 

BW5

 

 

 

 

4. Quickly remove a watermark from a b/w picture.

 

VAN.$$TIM=#time#

VAF.$$PIA=?exeloc\Igorslab.png

VAF.$$PIB=?exeloc\V1.png

ANA.Load|0|$$PIA

ANA.TriColor|0|&H90FFFF

ANA.bw|0|760

ANA.Show|0!

ANA.Save|0|$$PIB

ENR.

 

 

Orig_01         ->     clip0099   -> clip0098

 

 

 

Syntax

 

ANA.BW[|P1][|P2]

 

Parameter Explanation

 

P1 - opt. Image-Register number, if omitted, IR 0 will be used.

 

P2 - opt. Threshold-Level, the higher, the more black is in the picture, 765 - 1, 382.5 = Medium/default..

 

The Command will leave a 0/1 on the TOS. As always, a 0 means Error, while a 1 means "all fine".

 

 

Example

 

'***********************************

' ANA.BW-Sample

'***********************************

STW.ct|Chrome_WidgetWin_1|- Brave

ANA.Snap|0

ANA.Save|0|?path\Before.png

ANA.bw|0|60

ANA.Save|0|?path\After.png

ENR.

 

 

Quickly remove a watermark from a b/w picture.

 

VAN.$$TIM=#time#

VAF.$$PIA=?exeloc\Igorslab.png

VAF.$$PIB=?exeloc\V1.png

ANA.Load|0|$$PIA

ANA.TriColor|0|&H90FFFF

ANA.bw|0|760

ANA.Show|0!

ANA.Save|0|$$PIB

ENR.

 

 

Orig_01         ->           clip0098

 

 

Remarks

 

This command is not optimized, it may take up to several seconds for large pictures.

For a Window with size 1140x1410 i needed 36867812 Ticks (Speedtable using DMP.1), this is 2.3 Seconds on my computer, as my system can process 16000000 Ticks in one second.

 

 

Limitations:

 

-

 

 

See also: