command (MEL/Python)
|
MGImageProcesser
|
Go to: MEL synopsis. Python synopsis. Return value. Flags. MEL examples. Python examples.
MEL Synopsis
MGImageProcesser [-dimension] [-processOption] [-resize] [-style] imagePath
Python Synopsis
MGImageProcesser (string, [dimension=boolean], [processOption=string], [resize=string], [style=string])
Note: Strings representing image fullpath and arguments must be separated by commas. This is not depicted in the synopsis.
MGImageProcesser is NOT undoable, queryable, and editable.
This command process images.
Return value
Depend on the flag, the return value could be int array of image size, int for processed images, etc.
|
Flags
dimension, processOption, resize, style
Long name (short name)
|
Argument types
|
Properties
|
-dimension(-d)
|
|

|
|
This is a query only flag that can be used to query for the size of an image as int array, by providing a image file path.
|
|
-processOption(-po)
|
string
|
 
|
|
Process the image using the process option string, the option is of the "optionName = optionValue" format, one option for a line, joined with new line character '\n'. For example:
invert = 0
grayscale = 1
brightness = 0
contrast = 0
saturation = 0
blur = 0
opacity = 255
bgcolor = 0,0,0
hTile = 1
hTileGap = 0
vTile = 1
vTileGap = 0
The case for the option name does not matter. The value range for a certain option:
invert: [0~1]
grayscale: [0~1]
brightness: [-255,255]
contrast: [-255,255]
saturation: [-255,255]
blur: [0~18]
opacity: [0~255]
bgcolor: [0~255,0~255,0~255]
hTile: [0~10]
hTileGap: [0~100]
vTile: [0~10]
vTileGap: [0~100]
|
|
-resize(-r)
|
string
|
 
|
|
Resize the image file using the new size provided by string argument: "width:height". The width / height ratio of image will stay unchanged.
|
|
-style(-s)
|
|
 
|
|
Internal use only. Process the image using a style file. Input a style file full path as the argument.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can be used more than once in a command.
|
MEL examples
//get the size of image in int array:
MGImageProcesser -q -dimension "D:/test/Penguins.jpg";
//backup the original image befor process it:
sysFile -cp "D:/test/Penguins_orginal.jpg" "D:/test/Penguins.jpg";
//now process the image, the image will be changed:
MGImageProcesser -processOption "grayscale=1\nblur=10" "D:/test/Penguins.jpg";
Python examples
import maya.cmds as cmd
#get the size of image in int array:
cmd.MGImageProcesser("D:/test/Penguins.jpg", q=True, dimension=True)
#backup the original image befor process it:
cmd.sysFile("D:/test/Penguins.jpg", cp="D:/test/Penguins_orginal.jpg")
#now process the image, the image will be changed:
cmd.MGImageProcesser("D:/test/Penguins.jpg", processOption="grayscale=1\nblur=10")
|