未完待续

ps_app= createOLEObject "Photoshop.Application"

ps_app.Load "d:\\test\\aaa.tga"

ps_app.ActiveDocument.Selection.SelectAll()

ps_app.ActiveDocument.Selection.Copy()

ps_app.ActiveDocument.Paste()

ps_app.Quit()

ReleaseOLEObject ps_app

ps_app= undefined

GC() --释放内存

 加载文件

  ps_app.Load "d:\\test\\aaa.tga"

  打开文件个数

    ps_app.Documents.Count

  当前活动文件

    ps_app.ActiveDocument

      另存为

      ps_app.ActiveDocument.SaveAs(@"d:\test\ccc.psd")

         ps_app.ActiveDocument.SaveAs(@"d:\\test\\ccc", System.Type.Missing, System.Type.Missing, PsSaveDocumentType.psTargaSave) --C#里另存为其他格式的代码,不明白为什么会报错。望高人解答,错误如下:(System.Runtime.InteropServices.COMException”类型的未经处理的异常在 mscorlib.dll 中发生 )

    关闭当前活动文件

      ps_app.ActiveDocument.Close 2  --close([PsSaveOptions]) 1 psSaveChanges 2 psDoNotSaveChanges 3 psPromptToSaveChanges

颜色                                                                                  -- ForegroundColor前景色,BackgroundColor背景色

  ps_app.ForegroundColor.RGB.red = 255

  ps_app.ForegroundColor.RGB.Green= 128

  ps_app.ForegroundColor.RGB.Blue= 64

图片缩放

  图片大小

    ps_app.ActiveDocument.ResizeImage 512 512  -- ResizeImage([Width][, Height][, Resolution][, ResampleMethod])  

  画布大小

    ps_app.ActiveDocument.ResizeCanvas 1024 1024 1 --ResizeCanvas([Width][, Height][, Anchor]) Anchor (1上左,2上中,3上右,4中左,........9下右)

图层调整

  ps_app.ActiveDocument.Layers.Parent.ActiveLayer.Opacity = 50 -- 透明度

  ps_app.ActiveDocument.ActiveLayer.AdjustLevels 15 255 1 0 255 --使用色阶命令, inStart inEnd gamma outStart outEnd

   ps_app.ActiveDocument.Layers.Parent.ActiveLayer.BlendMode = 12 --调整图层模式-PsBlendMode 1 (psPassThrough)2 (psNormalBlend)3 (psDissolve)4 (psDarken)5 (psMultiply)6 (psColorBurn)7 (psLinearBurn)8              (psLighten)9 (psScreen)10 (psColorDodge)11 (psLinearDodge)12 (psOverlay)13 (psSoftLight)14 (psHardLight)15 (psVividLight)16 (psLinearLight)17 (psPinLight)18 (psDifference)19 (psExclusion)20 (psHue)21                          (psSaturationBlend)22 (psColorBlend)23 (psLuminosity)26 (psHardMix)

  向下合并图层

  ps_app.ActiveDocument.Layers.Parent.ActiveLayer.Merge() --向下合并图层

首选项

单位 --1(像素)2(英寸)3(厘米)4(毫米)5(点)6(派卡)7(百分比)

  标尺

    ps_app.Preferences.RulerUnits = 1

  文字

    ps_app.Preferences.TypeUnits = 5

自定义函数

fn get_ForegroundColor_RGB = --得到前景色RGB
(
ForegroundColor = #()
ForegroundColor[1] = ps_app.ForegroundColor.RGB.red as integer
ForegroundColor[2] = ps_app.ForegroundColor.RGB.Green as integer
ForegroundColor[3] = ps_app.ForegroundColor.RGB.Blue as integer
return ForegroundColor
)

fn set_ForegroundColor_RGB R G B = --设置前景色RGB
(
ForegroundColor = #()
ForegroundColor[1] = ps_app.ForegroundColor.RGB.red = R
ForegroundColor[2] = ps_app.ForegroundColor.RGB.Green = G
ForegroundColor[3] = ps_app.ForegroundColor.RGB.Blue = B
return ForegroundColor
)

How to use PhotoshopApplication in maxscript的更多相关文章

  1. 【转】MaxScript.Net接收本地端口的消息执行

    MaxScript里开不了线程,但是可以用.Net的BackgroundWorker来做后台处理 BackgroundWorker Fn BackgroundTcpListenerDoWork the ...

  2. MaxScript重启3dsMax的重新思考

    前天看到一位大神写用MaxScript实现重启3dsMax的方法,用的是.net临时编译一个exe出来,然后用这个新的进程来关闭并开启新的max.感觉这种思路不错,或许可以用在别的地方.不过谈及max ...

  3. 关于 MAXScript 拷贝文件夹及内容到其他位置

    之前用 hiddenDOSCommand 本机测试通过,但是换其他电脑有时会不能用... fn xcopy oldfile newfile = ( newfilepath = newfile + &q ...

  4. 关于如何获取/清除 MAXScript 侦听器内的文本

    关于如何获取/清除 MAXScript 侦听器内的文本 用来保存记录?还没想到实际用处,先记上. macroRecorder as string listener as stringclearList ...

  5. 关于 MAXScript 中文路径返回上级目录(精简版)

    之前写过一个 关于 MAXScript 中文路径返回上级目录 的博文 今天无意中发现了一个更简单的方法 代码如下: fn newfile filepath = ( nf = getfilenamepa ...

  6. 关于 MAXScript 如何剪切文件夹

    MAXScript 中可以对文件进行创建删除复制等操作但是唯独不能删除文件夹... 网上搜了一下批处理的剪切方法,在 MAXScript 里调用一下就好了 fn xcopy oldfile newfi ...

  7. 关于 MAXScript 逐行写入文本

    官方帮助文档FileStream Values部分有相关介绍. fn format_txt filepath filetext = ( if doesFileExist filepath == tru ...

  8. 关于 MAXScript 获取全部文件

    MAXScript 官方文档里关于获取文件夹下所有文件的方法 fn getFilesRecursive root pattern = ( dir_array = GetDirectories (roo ...

  9. maxscript, 批量导出物体

    1,将场景中所有选中物体整体导出为一个fbx文件 exportfile filename #noprompt selectedOnly:true using:FBXEXP 2,将场景中所有选中物体各导 ...

随机推荐

  1. String Problem - HDU 3374 (kmp+最大最小表示)

    题目大意:有一个字符串长度为N的字符串,这个字符串可以扩展出N个字符串,并且按照顺序编号,比如串  ” SKYLONG “ SKYLONG 1 KYLONGS 2 YLONGSK 3 LONGSKY ...

  2. Spring 报错:Error creating bean with name

    org.springframework.beans.factory.BeanCreationException: 原因是在autowire时,找不到相应的类,上述问题是因为XXXXX的实现类中没有加相 ...

  3. bzoj3669: [Noi2014]魔法森林 lct

    记得去年模拟赛的时候好像YY出二分答案枚举a,b的暴力,过了55欸 然后看正解,为了将两维变成一维,将a排序,模拟Kruskal的加边过程,同时维护1到n的最大值,加入一条边e(u,v,a,b)时有以 ...

  4. [Javascript] Using console.count to Count Events

    Learn how to user console.count in order to log out how many times a given thing has happened. ; i & ...

  5. 1小时学Python脚本

    如果我们有这么一项任务:简单測试局域网中的电脑是否连通.这些电脑的ip范围从192.168.0.101到192.168.0.200.        思路:用shell编程.(Linux一般是bash而 ...

  6. rsyslog安装

    http://www.rsyslog.com/downloads/download-other/ http://www.rsyslog.com/download/stable-download/pag ...

  7. visul svn+花生壳

    1.服务器端 工具:visul svn+花生壳 花色壳:注册域名 visul svn:配置http://www.cnblogs.com/bluewelkin/p/3479105.html 外网访问,端 ...

  8. RT: TCP connection close

    CLOSE is an operation meaning "I have no more data to send." The notion of closing a full- ...

  9. C#泛型类的简单创建与使用

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...

  10. poj 1201 Interval (查分约束)

    /* 数组开大保平安. 查分约束: 输入的时候维护st和end 设每个点取元素di个 维护元素个数前缀和s Sbi-Sai-1>=ci 即:建立一条从ai-1到bi的边 权值为ci 表示ai到b ...