• How to use PhotoshopApplication in maxscript


    未完待续

    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: estccc.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
    )

  • 相关阅读:
    PHP线程安全和非线程安全有什么区别
    SHOW SLAVE STATUS 详解
    linux 2>&1
    crontab 例行性排程
    clang-format 数组初始化,多行模式
    windows 10 1909 无法启用 .NET Framework 解决
    SysCtlDelay 实现延时
    wpa_supplicant 检测错误密码
    swig python dynamic module does not define init function
    讯飞错误码10116
  • 原文地址:https://www.cnblogs.com/guilt/p/4153801.html
Copyright © 2020-2023  润新知