nikmauro#32953
Hello i have a PSD with 2 smart objects with names Design & Design2, i create the following code to change the content of smart object layers.
The code replace only the smartframe with name Design2.
If comment the part2 code the smartframe with name Design working.
Plase any help how to resolve this problem.
The code replace only the smartframe with name Design2.
If comment the part2 code the smartframe with name Design working.
Plase any help how to resolve this problem.
public static String PsdChangeSO(String filename,String Template, String filename2)
{
var customResolver = new FontResolver(@"C:\inetpub\wwwroot\Images\FontCache");
var psdProcessor = new PsdProcessor(Path.GetTempPath());
//part1
psdProcessor.FrameCallback = (processor, frame) =>
{
if (frame.Type == FrameType.SmartObject && frame.Name == "Design")
{
var smartFrame = (PsdSmartFrame)frame;
var webclient = new System.Net.WebClient();
var uriimage = webclient.OpenRead(new Uri(filename));
return smartFrame.ToGraphicsContainer(new Aurigma.GraphicsMill.Bitmap(uriimage), ResizeMode.Fit);
}
else {
return processor.ProcessFrame(frame);
}
};
//part2
psdProcessor.FrameCallback = (processor, frame) =>
{
if (frame.Type == FrameType.SmartObject && frame.Name == "Design2")
{
var smartFrame2 = (PsdSmartFrame)frame;
var webclient = new System.Net.WebClient();
var uriimage = webclient.OpenRead(new Uri(filename2));
return smartFrame2.ToGraphicsContainer(new Aurigma.GraphicsMill.Bitmap(uriimage), ResizeMode.Fit);
}
else {
return processor.ProcessFrame(frame);
}
};
var outputFilename = GetTimestamp(DateTime.Now);
psdProcessor.Render(@"C:\inetpub\wwwroot\Images\"+Template, @"C:\inetpub\wwwroot\Images\Output\" + outputFilename + ".png");
return outputFilename+".png";
}