Aspose.PSD合并或DrawImage失败,报错“源数组不够长”。
创始人
2024-09-20 11:01:02
0

在使用Aspose.PSD的合并或DrawImage方法时,可能会遇到上述的“源数组不够长”错误,这是由于要合并的图片的尺寸比目标图片大造成的。解决方法是在合并或绘制之前,先将目标图片的大小调整为足够大的尺寸,再进行合并或绘制,如下所示:

// 加载目标图片 using (var dstImage = Image.Load(dstFilePath)) { // 创建一个新的图片,将目标图片的尺寸扩展为足够大 using (var newImage = new PsdImage( new PsdOptions(dstImage.Width * 2, dstImage.Height * 2))) { // 将目标图片绘制到新的图片上 newImage.DrawImage(dstImage, new Rectangle(0, 0, dstImage.Width, dstImage.Height), new Rectangle(0, 0, dstImage.Width, dstImage.Height));

    // 加载要合并的图片
    using (var srcImage = Image.Load(srcFilePath))
    {
        // 将要合并的图片绘制到新的图片上
        newImage.DrawImage(srcImage, new Rectangle(0, 0, srcImage.Width, srcImage.Height),
            new Rectangle(dstImage.Width, dstImage.Height, srcImage.Width, srcImage.Height));

        // 保存合并后的图片
        newImage.Save(dstFilePath, new PsdOptions());
    }
}

}

相关内容

热门资讯

透视肯定!aapoker万能辅... 透视肯定!aapoker万能辅助器(透视)插件(确实是有挂)1、打开软件启动之后找到中间准星的标志长...
透视私人局!aapoker插件... 透视私人局!aapoker插件(透视)透视方法(竟然是真的有挂);1、每一步都需要思考,不同水平的挑...
透视中牌率!aapoker破解... 透视中牌率!aapoker破解侠是真的吗(透视)透视方法(都是有挂)1、aapoker破解侠是真的吗...
透视脚本!aapoker安装包... 透视脚本!aapoker安装包怎么使用(透视)ai插件(果然是有挂)1、让任何用户在无需aapoke...
透视规律!aapoker脚本(... 透视规律!aapoker脚本(透视)脚本(果然真的是有挂)1、aapoker脚本系统规律教程、aap...
透视工具!aapoker透视脚... 透视工具!aapoker透视脚本入口(透视)透视插件(原来有挂)1、进入到aapoker透视脚本入口...
透视玄学!aapoker破解侠... 透视玄学!aapoker破解侠是真的吗(透视)透视脚本(好像是有挂)1、让任何用户在无需aapoke...
透视工具!aapoker辅助工... 透视工具!aapoker辅助工具安全吗(透视)透视脚本入口(其实有挂)1、上手简单,内置详细流程视频...
透视辅助!aapoker俱乐部... 透视辅助!aapoker俱乐部靠谱吗(透视)透视插件(原来是真的有挂)1、任何aapoker俱乐部靠...
透视最新!aapoker插件下... 透视最新!aapoker插件下载(透视)免费透视脚本(本来有挂);aapoker插件下载辅助器中分为...