[FIXED] Python Scripting für Photoshop – Reizeimage funktioniert nicht wie erwartet

Ausgabe

Ich versuche, eine einfache Operation durchzuführen. Ändern der Größe eines Bildes, das ich in Photoshop geladen habe.

Das ist mein Code

    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%")

Und das ist die illegale Operation, die ich bekomme, wenn ich versuche, die Größe des Bildes zu ändern. Irgendwelche Ideen?

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

pywintypes.com_error: (-2147352567, ‘Ausnahme aufgetreten.’, (0, u’Adobe >Photoshop’, u’Illegal Argument’, None, 0, -2147024809), None)

Lösung

Dies war ein Syntaxfehler.

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

musste sein

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

mit Kapital R.


Beantwortet von –
SuperDougDougy


Antwort geprüft von –
Clifford M. (FixError Volunteer)

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like