loonghao / photoshop-python-api

Python API for Photoshop.
https://loonghao.github.io/photoshop-python-api/
MIT License
613 stars 71 forks source link

Contact Sheet #76

Open GoGoGadgetGitHub opened 3 years ago

GoGoGadgetGitHub commented 3 years ago

Bug Discription:

The problem I'm experiencing is with the Application.makeContactSheet command. According to the documentation it has two arguments. An array of files (paths to all images that need to be on the contact sheet), and an array of options. However I've never been able to make it work.

Here is what I'm currently trying to do:

import photoshop.api as ps
from win32com.client import Dispatch
from os import path, walk
import inspect

dispatch = Dispatch("Photoshop.Application")  #Open PS
api = ps.Application()  #Application Object
Source = "Path to folder with all files"

files = [path.join(r,f) for r, sd, fs in walk(Source) for f in fs]  #Making an array of paths
options = [True, psApp, False, False, 6, True, None, 0, 7, 4, 3, 300, 3, None, True]

api.makeContactSheet(files , options )

I suspect that options array is incorrect, because I get this error: Illegal argument - argument 2\n- Object expected

I then decided to remove this array (Still not sure what I did wrong). Which helped me get as far as opening the Contact Sheet Dialog Window. However as you can see from the screenshot below, no files were selected.

Screenshot 2021-08-27 110546

Any help would be greatly appreciated. If you need any more information, please don't hesitate to ask.

Additional Context:

I'm trying to write a script that will make contact sheets for me. My end goal is to make a program that will create composite images containing all images I throw in a folder. I'm aware of the ContactSheet II script included in photoshop, the problem I have with this is you need to run it folder by folder. I want automate the entire process. Select a folder containing sub folders that I need to make contact sheets of and just let it run. The amount of images in each file is a variable, so I need to generalize the size of the image, the gap between them and the amount of rows and columns, based on that.

loonghao commented 3 years ago

Hi @GoGoGadgetGitHub makeContactSheet seems Deprecated for Adobe Photoshop CS4 image

I suspect that options array is incorrect, because I get this error:

options is an object https://theiviaxx.github.io/photoshop-docs/Photoshop/ContactSheetOptions.html#contactsheetoptions

GoGoGadgetGitHub commented 3 years ago

Does that mean it won't be able to work at all? @loonghao

loonghao commented 3 years ago

@GoGoGadgetGitHub I did some tests and found that only the corresponding window can be triggered, and the corresponding parameters are not effective and executed. Unfortunately, I don’t have any good solutions for the time being.