Layer.BlendingOptions

In My Project,I use Aspose.PSD to parse my psd file.And I find a BUG.That is when I use Layer.BlendingOptions.Effects .That array always empty!!! And after I use AddColorOverlay function and save the psd file,it’s useful but can’t be changed in my PhotoShop application.

language: .NET
PhotoShop Version: PhotoShop CC 2014
dll version: Aspose.PSD.20.5(dlls_only) net4.0
IDEA: Visual Studio 2017
psd download URL : MyPsdFile.zip (43.8 KB)

my code:

private void LoadLicense()
{
//it’s winform
string path = Path.Combine(Application.StartupPath, “License.txt”);
using (FileStream fs = new FileStream(path,FileMode.Open))
{
Aspose.PSD.License l = new Aspose.PSD.License();
l.SetLicense(fs);
}
}
private void GetPSDInfo()
{
string psdPath = Path.Combine(Application.StartupPath, “MyPsdFile.psd”);
using (PsdImage image = (PsdImage)Aspose.PSD.Image.Load(psdPath))
{
Layer[] layers = image.Layers;
StringBuilder sb = new StringBuilder();
foreach (var layer in layers)
{
sb.AppendLine(ParseLayerInfo(layer));
}
ShowText(sb.ToString());
image.Save();
}
}
string ParseLayerInfo(Layer layer)
{
StringBuilder s = new StringBuilder();
s.AppendLine(string.Format("==========={0}:{1}===========", layer.GetType().Name, layer.DisplayName));
//only Open this code can be Effects.Length > 0
//and the effect can’t changed on the PhotoShop
/*
var a = layer.BlendingOptions.AddColorOverlay();
a.Color = Aspose.PSD.Color.Red;
a.IsVisible = true;
a.Opacity = 255;
*/
int len = layer.BlendingOptions.Effects.Length;//this effect length always Zero
s.AppendLine(“Effects Count : " + len);
for (int i = 0; i < len; i++)
{
var effect1 = layer.BlendingOptions.Effects[i];
s.AppendLine(string.Format(”===========effect{0}===========", i));
var effectType = effect1.GetType();
var pps = effectType.GetProperties();
for (int j = 0; j < pps.Length; j++)
{
var pp = pps[j];
object o = pp.GetValue(effect1);
s.AppendLine(string.Format("{0}:{1}", pp.Name, o != null ? o.ToString() : “null”));
}
}
return s.ToString();
}

If fixed this BUG,Send me an email ! Thanks !
my email : linzhenyu_2006@126.com

@Mr_lin

Can you please try using latest Aspose.PSD for .NET 20.10 on your end and share if this is still incurring on your end or not.

I use NuGet install newest Aspose.PSD.20.10,and I try it again.But the effect is the same to version 20.5.
aspose.png (19.1 KB)

@Mr_lin

I have created an issue with ID PSDNET-753 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

any update on this issue? All effects in Layer.BlendingOptions on texts in my psd can’t be read.

@LudwigSchwarz

In order to solve this issue you should add argument new PsdLoadOptions() { LoadEffectsResource = true } to image load code.
Example:

        using (PsdImage image = (PsdImage)Aspose.PSD.Image.Load(psdpath, new PsdLoadOptions() { LoadEffectsResource = true }))
        {
        }

thanks! but why this option is false by default? should be enabled by default.

@LudwigSchwarz

This is internal API implementation. Moreover, every PSD doesn’t have effects by default inside as well.