ImageMagick++ (7.0.5-7-Q8-x64-dll)
Visual Studio 2015
Windows 10
Adobe Photoshop CS6 & CC 2017
I am reading in a custom formatted image that contains multiple image layers. I can create a Magick::Image object for each layer, and I can call Magick::Image::Write() on each Image object to write out a PSD file. But these PSD files only have one layer, obviously.
I want to be able to collect a bunch of Magick::Image objects and write out 1 PSD file with all those Images as separate layers within.
How can I do this with Magick++? I'm having trouble finding any help on this.
How to write multi-layer Photoshop PSD file?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to write multi-layer Photoshop PSD file?
For writing multiple images into a single file in Magick++, see http://www.imagemagick.org/Magick++/STL.html
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to write multi-layer Photoshop PSD file?
Be sure you create a flattened layer for the first layer, plus all your separate layers and write them all to PSD. PSD from ImageMagick must have the flattened layer first.
Re: How to write multi-layer Photoshop PSD file?
Thanks. I am now able to create a std::list<Magick::Image> of images. Then I use Magick::writeImages() to create the Photoshop file. But now when I open the PSD in Photoshop, all the layers are locked as a background layer, if you know what I mean. So, for example if I have 5 images that I'm creating 1 PSD out of, the PSD will end up with 5 layers and each of those layers is a "background" layer instead of a regular layer. Is there some special property I'm supposed to set on the individual Magick::Image objects before I call Magick::writeImages() on them?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to write multi-layer Photoshop PSD file?
I don't use Photoshop, and don't know the difference between a background layer and regular layer. Sorry.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to write multi-layer Photoshop PSD file?
What was your exact command line(s)?
You have to create the flattened layer and save it and then use that and your original layers.
or
You have to create the flattened layer and save it and then use that and your original layers.
Code: Select all
magick layer1 layer2 ... layer5 -background none -flatten flataenedlayer
magick flattenedlayer layer1 layer2 ... layer5 result.psd
Code: Select all
magick layer1 layer2 ... layer5 ( -clone 0--1 -background none -flatten ) +insert result.psd
Re: How to write multi-layer Photoshop PSD file?
I am not using a command line to do this. I am using the Magick++ API. I am creating a bunch of Magick::Image objects and then writing them to a PSD. The first image in the list of images is considered my "flattened" layer. The following images are the subsequent layers.
@snibgo
In Photoshop, when you start a new document you get a locked "background" layer to start with. You cannot edit the background layer. There can only be 1 background layer. You have the option to unlock and convert the background layer into a regular editable layer if you choose. There are not supposed to be multiple background layers, like ImageMagick is giving me when I run the Magick::writeImages() function. Magick::writeImages() is creating an unstable Photoshop document by creating multiple background layers. I hope I'm just doing something wrong in my process and someone here can correct me... Surely I'm not the first person to use Magick++ to create a multi-layer PSD.
@snibgo
In Photoshop, when you start a new document you get a locked "background" layer to start with. You cannot edit the background layer. There can only be 1 background layer. You have the option to unlock and convert the background layer into a regular editable layer if you choose. There are not supposed to be multiple background layers, like ImageMagick is giving me when I run the Magick::writeImages() function. Magick::writeImages() is creating an unstable Photoshop document by creating multiple background layers. I hope I'm just doing something wrong in my process and someone here can correct me... Surely I'm not the first person to use Magick++ to create a multi-layer PSD.
Re: How to write multi-layer Photoshop PSD file?
Hi, did you ever solve the "all background layers" issue?
I still run into it with Magick.NET
I still run into it with Magick.NET