Python Photoshop 脚本 - resizeImage 未按预期工作

Python Scripting for Photoshop - resizeImage not working as expected

我正在尝试执行一个简单的操作。调整我在 photoshop 中加载的图像的大小。

这是我的代码

    psApp.Open(psdFiles[0])  # Opens the PSD
    awayActiveDoc = psApp.Application.ActiveDocument  # Get active document object

    #Set units to pixels.
    psApp.Preferences.RulerUnits = 1

    #Printing out a bunch of info for the loaded doc.
    print "\n Active document:", awayActiveDoc.name
    print " Initial Doc size:", int(awayActiveDoc.width), int(awayActiveDoc.height)
    print " Doc path:", awayActiveDoc.path
    print " Doc BitsPerChannel:", awayActiveDoc.BitsPerChannel

    awayActiveDoc.Flatten()
    awayActiveDoc.resizeImage("51%", "51%")

这是我在尝试调整图像大小时遇到​​的非法操作。有什么想法吗?

File "e:\py_projects\py_crowd\test2.py", line 73, in awayActiveDoc.resizeImage("51%", "51%") File "C:\Python27\Lib\site-packages\win32com\client\dynamic.py", line 511, in getattr ret = self.oleobj.Invoke(retEntry.dispid,0,invoke_type,1)

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Adobe >Photoshop', u'Illegal Argument', None, 0, -2147024809), None)

这是语法错误。

awayActiveDoc.resizeImage("51%", "51%") 

需要

awayActiveDoc.ResizeImage("51%", "51%")

大写 R.