Home  Previous Next

command (MEL/Python)

MGImageProcesser

Go to: Synopsis. MEL examples. Python examples.

Synopsis

MGImageProcesser (string, [currentStyleName=boolean], [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.

 

Long name (short name)

Argument types

Properties

-currentStyleName(-csn)v2_transparent

 

query


Internal use only. This is a query only flag to get the current image processing config name.

Do not confuse the term "style" with the new picker style, this is just for snapshot image processing style.

-dimension(-d)

 

query


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

createedit


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

createedit


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)

string

createedit


Internal use only. Process the image using a style file. Input a style file full path as the argument.

Do not confuse the term "style" with the new picker style, this is just for snapshot image processing style.

 


create Flag can appear in Create mode of command

edit Flag can appear in Edit mode of command

query Flag can appear in Query mode of command

multiuse 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

from maya import cmds

#get the size of image in int array:
cmds.MGImageProcesser("D:/test/Penguins.jpg", q=True, dimension=True)

#backup the original image befor process it:
cmds.sysFile("D:/test/Penguins.jpg", cp="D:/test/Penguins_orginal.jpg")

#now process the image, the image will be changed:
cmds.MGImageProcesser("D:/test/Penguins.jpg", processOption="grayscale=1\nblur=10")

Home Previous Next