命令 (MEL/Python)
|
MGImageProcesser
|
跳转到: 概要. MEL例子. Python例子.
概要
MGImageProcesser (string, [currentStyleName=boolean], [dimension=boolean], [processOption=string], [resize=string], [style=string])
备注: Strings代表图片文件完整路径, 而参数则必须以逗号分隔。这是在概要里没有说明的。
MGImageProcesser不可撤消, 可以查询且可以编辑。
这个命令主要用来处理图片。
长名 (短名)
|
参数类型
|
属性
|
-currentStyleName(-csn)
|
|

|
|
仅供内部使用,用来查询当前界面上使用的图片处理风格的名字。
|
|
-dimension(-d)
|
|

|
|
这个标签只能用于查询指定图片的长宽,返回整数数组。
|
|
-processOption(-po)
|
string
|
 
|
|
通过指定处理配置字符窜来处理图片,这个配置字符窜每行都是“配置名=配置数值”这样的格式,并用换行符相连,比如:
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
这些配置名的大小写不区分。每个配置的取值范围如下:
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
|
 
|
|
指定"长:宽"这样的字符窜来缩放图片,注意图片的长宽比不会被改变。
|
|
-style(-s)
|
|
 
|
|
仅供内部使用。通过指定一个外部的图片样式文件路径来处理图片。
|
|
标签可以在创建模式中使用
|
标签可以在编辑模式中使用
|
标签可以在查询模式中使用
|
标签可以在一条命令中多次使用
|
MEL例子
//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例子
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")
|