Hi guys,
I am creating a python script which batch processes textures. Identifies potential candidates to be converted to grey scale and mode and process them in photoshop.
I’m having trouble with the “changeMode” command. Can’t find the right syntax to do it.
This is what I found in Photoshop’s documentation:
Document.changeMode (destinationMode: ChangeMode , options: DocumentConversionOptions )
And this is my code:
import win32com.client
psApp = win32com.client.Dispatch("Photoshop.Application")
psApp.Open("test.tga")
aDoc = psApp.Application.activeDocument
aDoc.changeMode("Grayscale")
psApp.close(1)
I have tried many different ways of passing the parameter but i always get the same error.
I’m getting this error:
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Adobe Photoshop', u'Illegal argument - argument 1
- Required value is missing', None, 0, -2147220262), None)
File "d:\Projects\Python\_image\find_greyscale_images.py", line 29, in <module>
aDoc.changeMode(ChangeMode)
File "C:\Python26\Lib\site-packages\win32com\client\dynamic.py", line 501, in __getattr__
ret = self._oleobj_.Invoke(retEntry.dispid,0,invoke_type,1)
I guess I’m not passing the arguments correctly but I can’t figure out how to do it.
Anyone can help?
Cheers!
R.