Resize PSD keeping layer properties

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
vroola12
Posts: 1
Joined: 2020-03-02T06:42:47-07:00
Authentication code: 1152

Resize PSD keeping layer properties

Post by vroola12 »

Hi all,

I have the following problem. Using the C# ImageMagick library 7.15.0 I try to resize a PSD file into another PSD while preserving the layers visibility. However, the result is that invisible layers get visible and the already visible layers get locked. The only related information I could find was that ImageMagick does not support some of the layer properties so this would then not be possible. I just want to confirm.

I tried several options with both MagickImage and MagickImageCollection
Tried using with or without the SetDefine however, now sure if I use them correctly. If I use them it does not seem to do anything. Tried them at several places in the code (before and after resize for example)

When using MagickImage the resize result is always a PSD with a single layer. (that single layer does then display correctly the result of all visible layers)
When using MagickImageCollection I just cannot seem to control the visibility. I do see that the Compose property of an layer is set to CompositeOperator.No when not visible, however, also when setting this Compose property after the resize the outcome is not different.

Code: Select all

using (var imageColl = new MagickImageCollection(path))
{
	Percentage perc = new Percentage(((double)width / imageColl[0].Width) * 100);
				
	foreach (var image in imageColl)
	{
		image.Resize(perc);

		image.Settings.SetDefine(MagickFormat.Psd, "additional-info", "all");
		image.Settings.SetDefine(MagickFormat.Psd, "preserve-opacity-mask", true);
	}

	imageColl.Write(resizePath);
}
So the question is, is this possible and if so, how?

Locked