Aspose.Psd for .NET - Strange image manipulation on 'Save' and error opening a file

Hi,

Thank you for your reply!

I also appreciate your suggestions, but as I unfortunately cannot follow them, I’ll wait for the fixes.

Hi again,

I’m checking in again about these bugs.
I noticed that the version 22.3 has been pushed, but these bugs aren’t in the release notes.

Could you please let me know if there’s an estimate of when these will be resolved?

Thank you!

@Pushbutton these issues are planned on 21.4, but there are risks that they will be postponed to 21.5

Hello,

I’m checking in again about these bugs.
Currently, in the version 22.6, these problems still persist.

Is there an estimate you can provide for these?

Thanks in advance

@Pushbutton at this moment only PSDNET-1072 “Incorrect transparency on saving of PSD file (RGB/16bit) on export to 8bit” is fixed. We tried to quickly fix PSDNET-1071, but found new blocking issues. We are working on issue with the incorrect compressing. After the fix of this logic your request will be given the highest priority.

@DmitriySorokin Thank you for the feedback!

Hi,

I’m checking in about the status of these tickets (PSDNET-1071 and PSDNET-2072).

Do you have any more details about when these fixes should be available?

Thanks!

@Pushbutton both task 1071 and 1072 are on code review. So, it’s possible that they will be in the nearest release.

Hi again,

I updated Aspose to the latest version:

  • Aspose.Imaging to 22.8.0
  • Aspose.PSD to 22.9.0

Unfortunately, the issue seems to persist:

  • Transparency is still lost
  • The generated file size is still shrunk by about the same amount - from 152MB to 3.66MB (I’m not sure if that’s relevant)

I’m still using the same file I provided - please let me know if you need me to send it to you again.

Is there something I may be missing? I’m still using the same code I mentioned earlier (‘Aspose.PSD.Image.Load’ followed by ‘image.Save()’)

Thank you

@Pushbutton Could you please clarify, did you try the code sample from the release notes? Aspose.PSD for .NET 22.9 - Release Notes|Documentation

string inputPsdFile    = "8bitWithTransparency.psd";
string outputPsdFile   = "16bitWithTransparency.psd";
string outputImageFile = "OutputWithTransparency.png";

using (var img = Image.Load(inputPsdFile))
{
    // 16 bit save options
    PsdOptions p16 = new PsdOptions() { ChannelBitsCount = 16, ColorMode = ColorModes.Rgb };

    img.Save(outputPsdFile, p16);
}
using (var img = Image.Load(outputPsdFile))
{
    // Save picture with 16 bit colors
    img.Save(outputImageFile, new PngOptions() { ColorType = Aspose.PSD.FileFormats.Png.PngColorType.TruecolorWithAlpha });
}

I checked this code sample and can confirm that in 21.8 it worked incorrect, after the saving of 8bit psd to 16 bit was missed transparency, but in Aspose.PSD 21.9 it works fine.

I have additional questions:

  1. Did you clean Solution after the updating of Aspose.PSD to 21.9?
  2. Do you use Aspose.PSD, but not Aspose.Imaging for this conversion?
  3. If it still doesn’t work correct, could you please send me full project with the input files and the result you are expecting.

Hi,

Sorry, I thought that just saving the file would now keep its colors, with no need to set the ‘options’ property.

I tried both of the code samples above:

  • outputPsdFile - the generated file still has transparency, when the original one doesn’t
  • outputImageFile - this file doesn’t have transparency, but I’m now losing a lot of information (since it becomes a PNG), such as layers

I’m not exactly sure what the problem is, as I have no deep knowledge of how image formats work, but is it possible for me to get a PSD fully similar to the original one?

Also, it seems that the problem are the bits per pixel - is there any way I can manipulate that, in order to get a similar result?

Finally, this problem appeared in this specific file, but the goal is to apply the algorithm to many different files - is there any way I can detect which files will have this problem just by looking at its properties?
I do not want to possibly ‘damage’ the other PSD files (which work fine), just because there’s a specific file where the ‘image.Save()’ method doesn’t work as expected.

Thanks in advance!

@Pushbutton could you please provide the some simple project with the source file and the expected result. Aspose.PSD can save any file in its previous color mode / bitdepth, but you should use save options this way: var options = new PsdOptions(sourcePsdImage);

If you provide the full code sample, we can help you to resolve issues.

I’ll send you a link where you can download a simple project (.NET Core 3.1, using the latest Aspose versions).
When you run this project, in the debug/release folder, you’ll see the created files, using different methods.

I ran a test, took a screenshot of how they look on Photoshop, and here are the results:
Output Comparison on Photoshop.jpg (399.4 KB)

Please ignore the watermark, as I didn’t add the license to the sample project.

As you can see, Method 1 and 2 add a visible change to the image (chess background from Photoshop is visible, if you zoom in) - this was also the same behavior on previous versions of Aspose.PSD (22.6.0, for example).

Note that method 1 uses the save options you’ve mentioned, however I was actually using the ‘save’ method without that parameter, which provided the same results (chess background).

This image is also in the project’s folder I’ll send via DM.

There’s another error I’m getting on 22.9 (I noticed earlier but I wasn’t sure if it was a problem on my end):
The generated files throw an error on Photoshop:

Problems were encountered readyng layers
"Background"
"BG"
because of a program error.

Thank you!

Hi, as requested, here’s the link to the sample project:
https://drive.google.com/drive/folders/1wOr3mL_RSc6vGW_1jp57W5MNJ_1S_pWQ?usp=sharing

Thank you

@Pushbutton thank you. I can confirm the bug. In the 1071 and 1072 were fixed issues with opening and conversion of 8bit to 16bit, but in the provided test project we have the opposite situation.

The publishing of the hot-fix for the Aspose.PSD 22.9 is planned for the next week, if it will be possible, the fix of your case will be added, otherwise, please follow the PSDNET-1281. Incorrect transparency on saving of 16 bit image to 16 or 8 bit image.

The issues you have found earlier (filed as PSDNET-1072) have been fixed in this update. This message was posted using Bugs notification tool by Yaroslav.Lisovskyi

The issues you have found earlier (filed as PSDNET-1071) have been fixed in this update. This message was posted using Bugs notification tool by Yaroslav.Lisovskyi

Hi again,

I received an update about the tickets PSDNET-1071 and PSDNET-1072.

I wanted to check in back with you, because I’m still running into some troubles with both tickets.

I’ll send you a direct message where you can test both situations, but here are the details for each of them:

PSDNET-1071:
Although the ‘Image.Load()’ now works, the ‘image.Save()’ throws the same error.

PSDNET-1072:
I’m aware that there’s a new ticket, PSDNET-1281, but I’m confused about the update I received for PSDNET-1072.
I can see in the changelog that the sample code loads a PSD, generates an intermediate PSD and then a PNG. However, the goal is not to have a PNG, but instead to have the second PSD without added transparency (from my tests, which you can see in the solution I’m sending as DM, the generated PSD still has transparency added).

Thank you

@Pushbutton I’ll check the direct message and then text you back.

The issues you have found earlier (filed as PSDNET-1281) have been fixed in this update. This message was posted using Bugs notification tool by Yaroslav.Lisovskyi