Aspose.psd saving issue

PSD saving issue: importing a new PSD without making any modifications and exporting it directly. The color of the PSD file does not match the original image. I don’t know where the problem lies. Could you please help me solve the problem? The effect is as shown in the picture. Using version aspose v23.10.0 is incorrect. The color in the picture is normal. If it is abnormal, it will become black after exporting. Only the import and export functions are available. Is this a parameter issue or is this version not supported? Attached is the PSD source file
1-21-8.jpg (41.5 KB)

12-222.jpg (28.3 KB)
test1.7z (2.4 MB)

@vincent2024
After the investigation, I’ve found that in your file added Bevel&Emboss Layer effect that is not supported in Aspose.PSD yet.

If you don’t need to edit file please check this workaround:
string sourceFile = @“test1.psd”;
string outputFile = @“test1out.jpg”;

        using (var psdImage = (PsdImage)Image.Load(sourceFile, new PsdLoadOptions() { LoadEffectsResource = true, ReadOnlyMode = true }))
        {
            psdImage.Save(outputFile, new JpegOptions() { Quality = 90 }); 
        }

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-506,PSDNET-2013

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@vincent2024 current rendering of Aspose.PSD 24.4 for this file the following:

In edit mode:
test1out.jpg (102.6 KB)

In read-only mode:
test1out.jpg (74.5 KB)

When can we support such an effect
Or can I merge all layers after editing the layer content and perform a save operation
If possible, could you please write a demo? Thank you

@vincent2024 at this moment ETA of Bevel&Emboss Q3-Q4 of 2024.

Or can I merge all layers after editing the layer content and perform a save operation

Aspose.PSD can get only pixel-perfect preview of whole PSD Image. In this case editing is impossible.

But if you open PSD File for edit, after the editing, preview of PSD file will not be correct but all data of Bevel&emboss will be saved as effect correctly. So, if the file will be opened with Photoshop agaon, it will repaint effects and all your other changes made in Aspose.PSD should be in place.

Hello, I also want to inquire about a question. Why is the PSD file that I saved directly open in Photoshop? There is a prompt window saying that there is an error in layer reading and clicking to continue can open it. What is the reason for this problem? Attached is an explanatory image
image.png (3.3 KB)

at this moment ETA of Bevel&Emboss Q3-Q4 of 2024. Will there be any notification then

@vincent2024

What is the reason for this problem? Attached is an explanatory image
Could you please provide input file and the code snippet to reproduce this.

@vincent2024 notification will be sent using forum. Bevel&Emboss Task ID is PSDNET-506

I have resolved the error issue which was caused by an excessively high version of Photoshop. My PSD file contains PSB, and I would like to replace the original PSB file through code. How can I achieve this

The smartObject Layer I am currently using Is there any other solution to implement ReplaceContents

smartObjectLayer.ReplaceContents

The replacement is successful now, but the font effect is no longer available. Could you please provide a solution code for setting the font? Thank you

Can you directly edit the PSB file for the smart object layer? Rewrite the text layer content or replace the image without replacing the PSB. If so, could you please provide a code? Thank you

@vincent2024 please check the following example, but pleas not that we fix this issue only Aspose.PSD 24.2 (PSDNET-1642 Aspose.PSD for .NET 24.2 - Release Notes|Documentation) :

string inputFile ="source.psd";
string output2 = "output.png";

PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.LoadEffectsResource = true;

using (PsdImage psdImage = (PsdImage)Image.Load(inputFile, psdLoadOptions))
{
    SmartObjectLayer smartObject = (SmartObjectLayer)psdImage.Layers[1];

    using (PsdImage smartObjectImage = (PsdImage)smartObject.LoadContents(psdLoadOptions))
    {
        smartObject.ReplaceContents(smartObjectImage);
    }

    psdImage.Save(output2, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}

What is the reason why the font is lost when I set the specified font in PSB and replace it with an updated one in PSD

@vincent2024 could you please provide input file and code to reproduce this.

        var warpLoadOptions = new PsdLoadOptions() { LoadEffectsResource = true, ReadOnlyMode = false, UseDiskForLoadEffectsResource = true };
        using (PsdImage image = (PsdImage)PsdImage.Load(psdPath, warpLoadOptions)) //warpLoadOptions
        {

            foreach (var layer in image.Layers)
                if (string.Equals(layer.DisplayName, "test", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (layer is SmartObjectLayer smartObjectLayer)
                    {
                        Console.WriteLine("替换 -- >  " + layer.DisplayName);
                        smartObjectLayer.ReplaceContents(@"C:\Users\Lt\Desktop\test\test.psb");
                        // smartObjectLayer.SmartObjectProvider.UpdateAllModifiedContent();
                        //smart.ReplaceContents(imageInSmart); //更新图层
                    }
                }
            {

test.7z (18.9 KB)

The updated PSD file does not change the font and is invalid

ok_error.7z (84.9 KB)

The running effect is shown in the figure, one is correct and the other is incorrect

I used the following code:

        string sourceFile = @"test.psd";
        string replaceFile = @"test.psb";
        string outputFile = @"output.psd";

        var warpLoadOptions = new PsdLoadOptions() { LoadEffectsResource = true, ReadOnlyMode = false, UseDiskForLoadEffectsResource = true };
        using (PsdImage image = (PsdImage)PsdImage.Load(sourceFile, warpLoadOptions)) //warpLoadOptions
        {

            foreach (var layer in image.Layers)
            {
                if (string.Equals(layer.DisplayName, "test", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (layer is SmartObjectLayer smartObjectLayer)
                    {
                        Console.WriteLine("替换 -- >  " + layer.DisplayName);
                        smartObjectLayer.ReplaceContents(replaceFile);
                        smartObjectLayer.UpdateModifiedContent();
                    }
                }
            }

            image.Save(outputFile);

        }
    }

And get the following result:
output.png (2.6 KB)

The text is cropped on the bottom. It because I have not [KaiTi] font installed. Could you please clarify if you have installed KaiTi font? If the font is not installed, both Photoshop and Aspose.PSD try to replace font, that can lead to the visual artifacts because of the different base font size and other font properties.