Jul-25-2019, 02:17 PM
Hello.
I am using Windows 7, Python 3.6, editor Pycharm.
My goal :
Apply recorded action in Photoshop to many folders and subfolders containing images
My inspiration :
https://vsfxryan.com/portfolio/python-ph...n-scripts/, although I would not like to use function definitions in my code, because I do not know how to do it.
My code :
Thanks
I am using Windows 7, Python 3.6, editor Pycharm.
My goal :
Apply recorded action in Photoshop to many folders and subfolders containing images
My inspiration :
https://vsfxryan.com/portfolio/python-ph...n-scripts/, although I would not like to use function definitions in my code, because I do not know how to do it.
My code :
import os import shutil import win32com.client psApp = win32com.client.Dispatch("Photoshop.Application") input_1 = "location input 1" output = "location output" for src_dir, dirs, files in os.walk(input_1): dst_dir = src_dir.replace(input_1, output, 1) if not os.path.exists(dst_dir): os.makedirs(dst_dir) for file_ in files: src_file = os.path.join(src_dir, file_) dst_file = os.path.join(dst_dir, file_) if os.path.exists(dst_file): os.remove(dst_file) shutil.copy(src_file, dst_dir) for dirpath, dirnames, filenames in os.walk(output): for filename in filenames: if filename.endswith(('.tif')): doc = psApp.Open(output + "\\" + filename) # Action 'jpg q8' in Photoshop makes some changes like converting to profile srgb : doc = psApp.DoAction('jpg_q8','Default Actions') # here I would like to save my file as jpg quality=8, but I do not know how to do it : doc.Export ?????In https://vsfxryan.com/portfolio/python-ph...n-scripts/, there are lines and codes about saving the file as PNG8 (search 'PNG8' in the web page), but how to do it as JPG quality 8?
Thanks
