How to convert PNG with transparency to PSD

Hi, I have been trying to convert a PNG to a PSD while preserving the transparent background, but have been struggling to get the library to not make the transparent areas black. Am I just missing something or is this the expected behaviour?

@Donato381,

Can you please share source file so that we may further investigate to help you out.

Hi @Adnan.Ahmad
people_clipped_rev_3.png (141.4 KB)
Here is the PNG file I am attempting to convert into a PSD. I also need to insert a little metadata like the author and edit date. I have managed to get the file to convert with the metadata inserted but the transparency always turns black upon converting. If you could point me in the right direction for getting the transparency to persist I would greatly appreciate it.

@Donato381,

Can you please try to use following code snippet on your end. Also please try to open generated file in Photoshop to see the transparency.

string dataDir = “F:\Aspose Work\”;

  	using (PngImage iimage =(PngImage)Image.Load(dataDir+"people_clipped_rev_3.png"))
  	{

  		using (PsdImage image = new PsdImage(iimage.Width, iimage.Height))
  		{
  			Layer layer = new Layer(iimage);
  			image.AddLayer(layer);
  			image.Save(dataDir+"people_clipped_rev_3.psd", new PsdOptions() { });
  		}
  	}

@Adnan.Ahmad

I am having a little trouble implementing the code you provided. On my end I cannot Initialise ‘Layer’ with iimage and ‘PsdImage image’ does not contain a method for AddLayer.

@Donato381,

I like to inform that AddLayer was added in 19.11 release assembly which will be released in the beginning of November. I request for your patience.

Hi @Adnan.Ahmad

So the code you provided will work on the new release?
If that is the case I will gladly wait until the next release.

Thanks for the assistance.

@Donato381,

Yes, this will work in 19.11.