Can I export a layer from PSD with layer styles attached?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
kfitfk
Posts: 9
Joined: 2015-07-02T00:42:48-07:00
Authentication code: 6789

Can I export a layer from PSD with layer styles attached?

Post by kfitfk »

Say I have a simple PSD file with two layers - a background layer and a text layer.

The background layer is just a normal layer filled with pure white. And the text layer is created by the Horizontal Type Tool. Then I apply a stroke layer effect to the text layer.
Image

I save the file as layer_style.psd. It is the left image in the screenshot below.

When I do

Code: Select all

convert layer_style.psd[0] merged.png
The exported image just looks the same as the PSD file. The stroke around the text stays intact. See the image in the middle of the screenshot below.

However, if I just export the text layer, which is the 2nd layer in my case

Code: Select all

convert layer_style.psd[0] layer_style.psd[2] \( -clone 0 -alpha transparent \) -swap 0 +delete -coalesce -compose src-over -composite text.png
The output image only contains the text, no stroke layer style attached. See the image on the right below.(I use the long command above because I want the output file to be the same size as the original PSD file.)

Below is a screenshot of the original PSD file, the exported full image, and the exported text layer image.
Image

So I got 2 assumptions.

1. IM understands Photoshop layer styles because when I export the composite image, the result looks the same as it appears in Photoshop. I'm just not using the right way to export the text layer so I lose the stroke layer style.
2. IM doesn't understand Photoshop layer styles. It is due to the PSD file itself containing a composite image. So when I convert layer_style.psd[0], IM just grabs that information and renders the output file. When I export only the text layer, the stroke layer style is ignored.

Could somebody tell me which one is right?

BTW, I'm working on an online image editor that allows my client to upload a PSD file. If layer style is not supported, I should tell them to rasterize all effects before uploading.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Can I export a layer from PSD with layer styles attached?

Post by dlemstra »

Your second assumption is correct. The PSD file contains a composite image and that is used to create the output image. We currently don't support layer styles.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
kfitfk
Posts: 9
Joined: 2015-07-02T00:42:48-07:00
Authentication code: 6789

Re: Can I export a layer from PSD with layer styles attached?

Post by kfitfk »

Got it. Then I need more simplified PSD parsing process.
Thanks.
Post Reply