We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Saving textLayer to JPG loses shadow/stroke

Hi there,

I’m just starting to use the Aspose.NET library, and I’m trying to replace text within a TextLayer and keep the existing drop shadow / stroke effect.

This works when exporting to a PSD. But converting to a PNG or JPG (including with true color/alpha settings and quality set at 100) loses the drop shadow and effects.

How do I retain the exact styles applied to a text layer, but just change the text?

Thanks!

@leebenson,

To resolve this issue try to load PsdImage with option PsdLoadOptions.LoadEffectsResource=true, also after changes in TextLayer you need to update its preview by using the UpdateLayerData method.
Code example with recommendations:

        using (PsdImage image = (PsdImage)Image.Load("file.psd",
            new PsdLoadOptions() { LoadEffectsResource = true }))
        {
            TextLayer textLayer = image.Layers[0] as TextLayer;

            // do some changes in textLayer
            textLayer.TextData.UpdateLayerData(); // Update preview of text layer after changes

            image.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
        }

If it does not help, send an example of your source code and files.

1 Like

Works like a charm, thank you!