A Wand way of converting PSD to one PNG

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
binbin
Posts: 3
Joined: 2016-01-23T12:03:26-07:00
Authentication code: 1151

A Wand way of converting PSD to one PNG

Post by binbin » 2016-01-23T13:45:31-07:00

Hi,
I am trying to convert a PSD file to a PNG file with Wand API.

I understand that by default imagemagick will convert each layer in a PSD file into separated PNG file.

With imagemagick 'convert' command line I can use '-flatten' parameter to merge all layers into a single PNG file, so I want to know how to do the same thing with the 'wand' method.

Any advice will be appreciated. My libmagickwand library is from the version 6.6.9.7.

User avatar
fmw42
Posts: 25425
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: A Wand way of converting PSD to one PNG

Post by fmw42 » 2016-01-23T14:00:41-07:00

The first layer of a PSD file is the flattened layer. So just convert the first layer to PNG.

In commmand line, one would do

Code: Select all

convert image.psd[0] image.png
Sorry, I do not know how to do that in any APIs.

binbin
Posts: 3
Joined: 2016-01-23T12:03:26-07:00
Authentication code: 1151

Re: A Wand way of converting PSD to one PNG

Post by binbin » 2016-01-23T22:26:45-07:00

Thanks for the reply. I did try to get the first layer with the prefix [0] but that's not the flattened one.
But the command "convert -flatten image.psd image.png" creates the flattened one that I was expecting.

This is the sample I used for testing:
http://www.freepik.com/free-psd/spring- ... 766469.htm

Post Reply