Python Forum
Python Script to repeat Photoshop action in folders and subfolders
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Script to repeat Photoshop action in folders and subfolders
#3
Thanks DeaD_EyE.

Here is the code in the cited Web page :

 def edit_File( actionScript, imagePath, saveDir, psApp ):
    #png save options
    options = win32com.client.Dispatch('Photoshop.ExportOptionsSaveForWeb')
    options.Format = 13   # PNG
    options.PNG8 = True  # Sets it to PNG-8 bit

    #new folder save location
    folder, filename = os.path.split( imagePath )
    filename, ext = os.path.splitext( filename )
    filenamePng = filename + ".png"
    newSave = os.path.join( saveDir, filenamePng )

    ##&& check to make sure file does not already exist

    
    #open image
    doc = psApp.Open(imagePath, None)
    #run action script
    psApp.DoAction( actionScript, 'WaterMark')
    #save
    doc.Export(ExportIn=newSave, ExportAs=2, Options=options)
    return doc
I am wondering where I could find the value of options.Format in...
options.Format = 13   # PNG
so that I can get JPG instead of PNG... plus the additional options you are evoking...

Any idea?
Reply


Messages In This Thread
RE: Python Script to repeat Photoshop action in folders and subfolders - by silfer - Jul-25-2019, 03:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What script to paste folders thenewcoder 1 708 Nov-29-2023, 09:40 AM
Last Post: Pedroski55
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,463 Jun-29-2023, 11:57 AM
Last Post: gologica
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 1,435 May-22-2023, 10:39 PM
Last Post: ICanIBB
  Pixel color and action Sartre 4 2,198 Apr-13-2023, 03:26 AM
Last Post: Sartre
Question Running an action only between certain times alexbca 9 1,823 Mar-15-2023, 04:21 PM
Last Post: deanhystad
  Checkbox itens with a button to run action Woogmoog 3 999 Dec-19-2022, 11:54 AM
Last Post: Woogmoog
  python move folders and subfolders not working mg24 5 2,320 Nov-09-2022, 02:24 PM
Last Post: Larz60+
Question Running an action only if time condition is met alexbca 5 1,394 Oct-27-2022, 02:15 PM
Last Post: alexbca
  Repeat request by else stsxbel 2 1,228 Jul-30-2022, 03:34 PM
Last Post: stsxbel
  get out of while loop and stop repeat Frankduc 11 3,133 Apr-26-2022, 10:09 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020