Macro command of MyBox(Not complete)

1 Usage of macro commands

"Macro Command" is a line with complete operation and parameters to be executed, instead of inputs or selections in GUI.

2 Execute macro commands

Macro commands can be executed in following 2 ways:

  1. Run the operation and output results without GUI of MyBox.
    Example, run following in command window of system:
    java -jar .\MyBox.jar image sharp algorithm=four color=keep edge=copy inputFile='D:\MyBox-test\images\v1.png' outputFile='D:\temp\2\v1_sharp_4neighborg_keep_copy.png'
    Macro commands of MyBox can be part of user's shell scripts. Also be useful for batch operations.

  2. Run the operation and display results In GUI of MyBox.
    Example, run following with manager window of macro commands in MyBox:
    image sharp algorithm=mask color=grey edge=zero inputFile='D:\MyBox-test\images\v1.png' outputFile='D:\temp\2\v1_sharp_mask_grey_zero.png'
    Macro commands are organized in tree by MyBox. Examples are provided, including important parameters of most functions.

3 Format of macro

Macro commands of MyBox are defined as following:

function_name operation_name parameter1 parameter2 ... parameterN

4 Common parameters

Following parameters work for all functions and operations:

parameter name parameter value default value comments
inputFile complete path of file example file of MyBox file to be handled
If this paramter is omitted, example file is referred.
outputFile complete path of file temporary file of MyBox File to be generated.
If this paramter is omitted, generat object by default method of MyBox.
openResult true: open the result
false: not open the result
When run macro by command line, default value is false.
When run macro in GUI of Mybox, default value is true.
Whether open the result.

5 Handle image(image)

When handle image, the function name is "image". Operations and their parameters are mentioned in following.

5.1 Edit(edit)

Operation name is "edit". Valid parameter is "inputFile" while "outputFile" is ignored.

Refer exmaple image:

image edit

Example of parameters:

image edit inputFile='D:\MyBox-test\images\v1.png'

5.2 Replace color(replace)

Operation name is "replace". Parameters:

parameter name parameter value default value comments
color web value of color
like "#0000FF", "hsla(270,100%,100%,1.0)"
color to be matched
newColor web value of color
like "0x0000FF", "rgba(0,0,255,1.0)"
color to be replaced
invert true:match invertedly
false:match
false whether match invertedly
trans true:handle transparency
false:not handle transparency
false whether handle transparency
algorithm RGBRoughWeightedEuclidean: RGB rough weighted euclidean
RGBWeightedEuclidean: RGB weighted euclidean
RGBEuclidean: RGB euclidean
HSBEuclidean: HSB euclidean
Red: red
Green: green
Blue: blue
Hue: hue
Saturation: saturation
Brightness: brightness
RGBManhattan: RGB manhattan
CIE76: LUV color space
CIEDE2000: colors difference
CIE94: colors difference
CMC: colors difference
RGBRoughWeightedEuclidean algorithm of matching colors
threshold float default threshold of algorithm the threshold of matching colors
hueWeight float default weight of algorithm weight of hue. Only works for CIEDE2000, CIE94, HSBEuclidean
brightnessWeight float default weight of algorithm weight of brightness. Only works for CIEDE2000, CIE94, HSBEuclidean, CMC
saturationWeight float default weight of algorithm weight of saturation. Only works for CIEDE2000, CIE94, HSBEuclidean, CMC
hue true: replace hue
false: not replace hue
true whether replace hue
brightness true: replace brightness
false: not replace brightness
false whether replace brightness
saturation true: replace saturation
false: not replace saturation
false whether replace saturation

Refer example image:

image replace color=0xfa7094 newColor=0x7777FF outputFile='D:\temp\2\example_replace.png'

Example of parameters:

image replace color=0xfa7094 newColor=0x3377CC algorithm=CMC threshold=1 inputFile='D:\MyBox-test\images\v1.png' outputFile='D:\temp\2\v1_replace_cmc_w6.png'

5.3 Sharp(sharp)

Operation name is "sharp". Parameters:

parameter name parameter value default value comments
algorithm four: Four-neighbor Laplace
eight: Eight-neighbor Laplace
mask: Unsharp masking
mask algorithm of sharping
color keep: keep color
grey: convert to grey
blackwhite: convert to black-white
keep whether convert colors
edge copy: copy edges
zero: fill zero in edges
copy how to handle pixels in edges
intensity integer. Suggest less than 5 2 radius of convolution. Only works for unsharp masking

Refer example image:

image sharp outputFile='D:\temp\2\example_sharp.png'

Example of parameters:

image sharp algorithm=eight color=blackwhite edge=zero inputFile='D:\MyBox-test\images\v1.png' outputFile='D:\temp\2\v1_sharp_8neighborg_bw_zero.png'