开发人员可以快速使用
Aspose.Imaging for .NET提供的API为PSD文件中的图层导入各种图片,通过控件提供的Layer类里的DrawImage方法来添加或者导入图片到图层里,使用DrawImage方法时需要图片的位置以及图片值,具体可以参考下面的部分代码,开发人员可以从
控件中国网上下载该产品的最新版本进行该功能的测试:
//Declare variables to store file paths for input and output.
string sourceFileName = "source.psd";
string outputFileName = "result.psd";
// Load a PSD file as an image and caste it into PsdImage
(sourceFileName))
{
// Extract a layer from PSDImage
// Load the image that is needed to be imported into the PSD file.
string normalImagePath = "png_normal.png";
using (RasterImage drawImage = (RasterImage)
Aspose.Imaging.Image.Load(normalImagePath))
{
// Call DrawImage method of the Layer class and pass the image instance.
}
//Save the results to output path.
image.Save(outputFileName, new PsdOptions());
}