Relink Smart Object doesn't apply to all Smart Object in PSD file

Hi community,
I have a problem when trying to use method RelinkToFile(file) but it doesn’t replace all linked smart objects in PSD file.
When trying to relink one by one, it’s only work for only first Layer, the second layer return this error
image.png (37.3 KB)

@gazelle.lord could you please provide input file and the code to reproduce this issue.

Hi @Dmitriy.Sorokin,
this is my PSD file with 6 Smart Object linked to one file. PSD Mockup
File to Replace
And this is my code:

var files = Directory.GetFiles(@“C:\Design”);

var mainImage = (PsdImage)Image.Load(“w22.psd”);

var mainActive = mainImage.Layers.Where(x => x.GetType() == typeof(SmartObjectLayer)).OfType().FirstOrDefault();

foreach (var file in files)
{
mainActive.RelinkToFile(file);

// todo
// when save then not effect from file
mainImage.Save("Output\\" + Path.GetFileName(file), new JpegOptions());

}

@gazelle.lord
I can confirm issue. Replacement of any second smart layer leads to exception.
We have opened the following new ticket(s) with High Priority in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-2093

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.

Also, I’ve found additional issues, I’ll update this topic after detailed investigation.

1 Like

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