Browse our Products

Aspose.PSD for .NET 26.4 - Release Notes

KeySummaryCategory
PSDNET-2701Implement rendering of Gradient with Smooth method.Feature
PSDNET-2606Update Aspose.Drawing to 26.2 version.Enhancement
PSDNET-548Add support for a resource containing effects in a group layer.Bug
PSDNET-2710PSD files with adjusted Hue/Saturation will throw the exception PsdImageArgumentException - Invalid Hue2 Resource data.Bug

Public API Changes

Added APIs:

  • T:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.InterpolationMethod
  • F:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.InterpolationMethod.Classic
  • F:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.InterpolationMethod.Perceptual
  • F:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.InterpolationMethod.Linear
  • F:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.InterpolationMethod.Smooth
  • F:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.InterpolationMethod.Stripes
  • P:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.IGradientFillSettings.InterpolationMethod
  • P:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.GdFlResource.InterpolationMethod
  • P:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.GrdmResource.InterpolationMethod
  • P:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.GradientFillSettings.InterpolationMethod
  • P:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.GradientMapSettings.InterpolationMethod
  • T:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.IfxsResource
  • M:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.IfxsResource.#ctor
  • F:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.IfxsResource.TypeToolKey

Removed APIs:

  • None

Usage examples:

PSDNET-548. Add support for a resource containing effects in a group layer.

string sourceFile = Path.Combine(baseFolder, "example.psd");
string outputFile = Path.Combine(outputFolder, "export.psd");

var loadOptions = new PsdLoadOptions()
{
	LoadEffectsResource = true,
};

using (var psdImage = (PsdImage)Image.Load(sourceFile, loadOptions))
{
	// Example has 2 group layers with effects
	// Group layer with one effect
	LayerGroup layerGroupOne = (LayerGroup)psdImage.Layers[2];

	// Group layer with many effects
	LayerGroup layerGroupMany = (LayerGroup)psdImage.Layers[5];

	// Get the number of effects and verify their quantity
	int effectCountOne = layerGroupOne.BlendingOptions.Effects.Length;
	int effectCountMany = layerGroupMany.BlendingOptions.Effects.Length;

	// One effect in the group layer is in resource 'IfxsResource'
	IfxsResource ifxsResource = (IfxsResource)layerGroupOne.Resources[0];

	// Two or more effects in a group layer are in resource 'ImfxResource'
	ImfxResource imfxResource = (ImfxResource)layerGroupMany.Resources[0];

	// Add a third shadow to a group layer with multiple effects
	layerGroupMany.BlendingOptions.AddDropShadow();

	psdImage.Save(outputFile);
}

PSDNET-2701. Implement rendering of Gradient with Smooth method.

string sourceFile = Path.Combine(baseFolder, "GradientOverlay.psd");
string outputFile = Path.Combine(outputFolder, "output_GradientOverlay.psd");
string outputFilePng = Path.Combine(outputFolder, "output_GradientOverlay.png");

var srcMethod = InterpolationMethod.Linear;
var newMethod = InterpolationMethod.Smooth;

var opt = new PsdLoadOptions()
{
    LoadEffectsResource = true,
};

using (var image = (PsdImage)Image.Load(sourceFile, opt))
{
    // Read
    var effect = image.Layers[1].BlendingOptions.Effects[0] as GradientOverlayEffect;
    var gradientSettings = effect.Settings;
    AssertAreEqual(srcMethod, gradientSettings.InterpolationMethod);

    // Change
    gradientSettings.InterpolationMethod = newMethod;

    image.Save(outputFile);
    image.Save(outputFilePng, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}

// Check saved data
using (var image = (PsdImage)Image.Load(outputFile, opt))
{
    var effect = image.Layers[1].BlendingOptions.Effects[0] as GradientOverlayEffect;
    var gradientSettings = effect.Settings;

    AssertAreEqual(newMethod, gradientSettings.InterpolationMethod);
}

void AssertAreEqual(object expected, object actual, string message = null)
{
    if (!object.Equals(expected, actual))
    {
        throw new Exception(message ?? "Objects are not equal.");
    }
}

PSDNET-2710. PSD files with adjusted Hue/Saturation will throw the exception PsdImageArgumentException - Invalid Hue2 Resource data.

var hue2 = new Hue2Resource(new byte[136]);