<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Convert Colors > Image/Pixel-Color Operations |
MiniRobotLanguage (MRL)
ANA.TriColor
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 Three Colors
Here i have used a Color-Threshold of "0" that will evaluate to the default value of &H808080
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
ANA.TriColor|0|0
ANA.Save|0|?path\After.png
ENR.
Here you can see the picture before and after the operation, using the Threshhold of &H808080 and a threshold of &HF0F0F0 the 4th picture has a Threshold of &HF010F0 and the last picture has a Threshold of &H1010F0.
2. Due to the used technology, there is no difference whether you use &H1010F0 or &HF01010
The Values are not sorted to RGB but play a role all together.
STW.ct|Chrome_WidgetWin_1|- Brave
ANA.Snap|0
ANA.Save|0|?path\Before.png
' This will result in a B/W picture (left picture below)
ANA.TriColor|0|&HFFFFFF
' This will result in a grey picture (right picture below) because "0" will use the Medium Value of &H808080
ANA.TriColor|0|&H0
' This will result in the right picture below.
ANA.TriColor|0|&HFF40FF
ANA.Save|0|?path\After.png
ENR.
3. Making things lighter
Here we use a threshold of &H101010.
STW.ct|Chrome_WidgetWin_1|- Brave
ANA.Snap|0
ANA.Save|0|?path\Before.png
' This will result in a lighter picture (see picture below)
ANA.TriColor|0|&H010101
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.
->
Syntax
ANA.TriColor[|P1][|P2]
Parameter Explanation
P1 - opt. Image-Register number, if omitted, IR 0 will be used.
P2 - opt. Threshold value for Grey. If omitted or zero, &H808080 will be used.
The Command will leave a 0/1 on the TOS. As always, a 0 means Error, while a 1 means "all fine".
Example
'***********************************
' ANA.TriColor-Sample
'***********************************
STW.ct|Chrome_WidgetWin_1|- Brave
ANA.Snap|0
ANA.Save|0|?path\Before.png
ANA.TriColor|0|0
ANA.Save|0|?path\After.png
' See the speedtable
DMP.1
MBX.!
ENR.
Remarks
This command is not optimized, it may take up to several seconds for large pictures.
For a Window with size 1140x1410 i needed 40572261 Ticks (Speedtable using DMP.1), this is 2.5 Seconds on my computer, as my system can process 16000000 Ticks in one second.
Limitations:
-
See also:
•