photoshop-python-api icon indicating copy to clipboard operation
photoshop-python-api copied to clipboard

Contact Sheet

Open GoGoGadgetGitHub opened this issue 4 years ago • 3 comments

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.

  • OS: Windows 10
  • Photoshop Version: Photoshop-2021
  • Python Version: python-3.9

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.

GoGoGadgetGitHub avatar Aug 27 '21 09:08 GoGoGadgetGitHub

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

loonghao avatar Sep 04 '21 08:09 loonghao

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

GoGoGadgetGitHub avatar Sep 05 '21 09:09 GoGoGadgetGitHub

@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.

loonghao avatar Sep 06 '21 01:09 loonghao