Page 1 of 1

Combine two psd files into one, keep filename

Posted: 2019-09-12T00:27:36-07:00
by andrew31
Morning guys, wondering if possible to achieve something like this :

Let's pretend I have these files in the same folder : test-me-1.psd and test-me-5.psd

I want to combine them into a single psd file that would be called as the first file input, so in this case : test-me-1.psd

How I can achieve something like that ?

Filename would change constantly, but not the number.
Working on mac os
Would love to have an option of drag files into a droplet and convert multiple files at the same time.

Any help is appreciated.

Re: Combine two psd files into one, keep filename

Posted: 2019-09-12T06:27:07-07:00
by snibgo
What version of IM? I'll assume v7.

Code: Select all

magick test-me-1.psd test-me-5.psd test-me-1.psd
This reads the two input files, and overwrites the first. Is that what you want?

Re: Combine two psd files into one, keep filename

Posted: 2019-09-12T10:41:44-07:00
by fmw42
I do not think it is that simple. With PSD files, the first layer is the flattened layer from all the rest. Does the PSD files in this case have multiple layers?. Even if only one layer each, one would need to generate the flattened layer from the two images to add to the two individual layers.

Can the OP explain in more detail the layout of the two PSD files? Or provide examples to use for testing. And explain how the layers of each file need to be combined --- just adding more layers or by some kind of compositing?

Unix does not support drag and drop as far as I know. You would need to have a bash shell script to call imagemagick and then call that bash script from AppleScript to make it drag and drop.

Re: Combine two psd files into one, keep filename

Posted: 2019-09-12T22:23:57-07:00
by andrew31
snibgo wrote: 2019-09-12T06:27:07-07:00 What version of IM? I'll assume v7.

Code: Select all

magick test-me-1.psd test-me-5.psd test-me-1.psd
This reads the two input files, and overwrites the first. Is that what you want?
It is exactly what I need ! How simple was that ! But there's two small problems:

For some reasons the output file has 2 layers of the test-me-5.psd inside and they are all locked.
And the second problem is how I can run the script on multiple files at once without specifying the names every time ?

Something based on numbers ? Like I said it will always be nr 1.psd and 5.psd

Sorry if asking too much

Re: Combine two psd files into one, keep filename

Posted: 2019-09-13T04:48:09-07:00
by snibgo
andrew31 wrote:For some reasons the output file has 2 layers of the test-me-5.psd inside and they are all locked.
As Fred says, PSD files contain multiple images. The first is a flattened version of all the others. So your two input files contain flattened versions, and these are copied to the output, and an extra flattened version is added.

If you want, you could remove the input flattened images. Windows syntax:

Code: Select all

magick ^
  ( test-me-1.psd -delete 0 ) ^
  ( test-me-5.psd -delete 0 ) ^
  test-me-1.psd
Or bash syntax:

Code: Select all

magick \
  \( test-me-1.psd -delete 0 \) \
  \( test-me-5.psd -delete 0 \) \
  test-me-1.psd
Sorry, I know nothing about locked layers. I don't use Photoshop.

andrew31 wrote:And the second problem is how I can run the script on multiple files at once without specifying the names every time ?
You will need a script. This might find all the files with "1" in the name, and loop through these, running "magick" with each one. If you say what your platform is (eg bash or Windows) we might help more.

Re: Combine two psd files into one, keep filename

Posted: 2019-09-13T05:42:41-07:00
by andrew31
Thank you for detailed information !!!

I'm working on MacOSX so bash syntax I guess ?

Thank you !

Re: Combine two psd files into one, keep filename

Posted: 2019-09-16T01:11:38-07:00
by andrew31
It worked to delete the duplicated layer but the final file is not good. it's just a part of it :(

Re: Combine two psd files into one, keep filename

Posted: 2019-09-16T09:14:13-07:00
by fmw42
You need to rebuild the flattened layer from all the other layers after removing the flattened layer from each of the input images.

Code: Select all

magick \
  \( test-me-1.psd -delete 0 \) \
  \( test-me-5.psd -delete 0 \) \
  \( -clone 0--1 \) -insert 0
  test-me-1.psd