没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|产品更新|编辑:李显亮|2019-08-07 11:29:03.767|阅读 426 次
概述:近期发布了Aspose.Imaging for .NET v19.7,支持PartialRotater类中的优化策略,支持OTG(OpenDocument图形模板),本文我们一起来探索新版中的新增功能及其工作原理。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
Aspose.Imaging for .NET一种高级图像处理控件,允许开发人员创建,编辑,绘制或转换图像。图像导出和转换是API核心功能之一,它允许在不安装Photoshop应用程序或任何其他图像编辑器的情况下保存为AdobePhotoshop®本机格式。
近期发布了Aspose.Imaging for .NET v19.7,支持PartialRotater类中的优化策略,支持OTG(OpenDocument图形模板),下面我们一起来探索新版中的新增功能及其工作原理。>>欢迎下载Aspose.Imaging for .NET v19.7体验
//将文本转换为向量对象
using (Image image = Image.Load("text.psd"))
{
image.Save(fileName + "text_vector.pdf", new PdfOptions());
}//
//老式的转换与充分光栅化
using (Image image = Image.Load("text.psd", new PsdLoadOptions() { ReadOnlyMode = true }))
{
image.Save(fileName + "text_vector.pdf", new PdfOptions());
}//为目标加载的图像设置50兆字节的内存限制
using (var image = Image.Load(imageFilePath, new LoadOptions() { BufferSizeHint = 50 })) {
//执行RotateFlip操作
image.RotateFlip(RotateFlipType.Rotate90FlipNone);
//执行旋转操作
((RasterImage)image).Rotate(60); // rotate 60 degrees clockwise
}string baseFolder = "D:";
string fileName = "VariousObjectsMultiPage.otg";
ImageOptionsBase[] options = { new PngOptions(), new PdfOptions() };
foreach (ImageOptionsBase item in options)
{
string inputFileName = Path.Combine(baseFolder, fileName);
string fileExt = item is PngOptions ? ".png" : ".pdf";
string outputFileName = Path.Combine(baseFolder, fileName + fileExt);
using (Image image = Image.Load(inputFileName))
{
OtgRasterizationOptions otgRasterizationOptions = new OtgRasterizationOptions();
otgRasterizationOptions.PageSize = image.Size;
item.VectorRasterizationOptions = otgRasterizationOptions;
image.Save(outputFileName, item);
}
}using(Image image = Image.Load(“input.svg”))
{
image.Save(
“output.png”,
new PngOptions()
{
VectorRasterizationOptions = new SvgRasterizationOptions
{
PageSize = image.Size,
}
});
} string baseFolder =“D:
”;
string fileName =“standardSize.tif”;
string inputFileName = Path.Combine(baseFolder,fileName);
string outFileName = inputFileName +“。pdf”;
using(Image image = Image.Load(inputFileName))
{
PdfOptions pdfOptions = new PdfOptions {PageSize = new SizeF(612,792 )};
image.Save(outFileName,pdfOptions);
} string baseFolder = Path.Combine("D:","3286");
string fileName = "image2.wmf";
string inputFileName = Path.Combine(baseFolder, fileName);
using (Image image = Image.Load(inputFileName))
{
string script = ((WmfImage)image).GetPostScript();
string ethlonScript = File.ReadAllText(inputFileName + ".ps");
if (script != ethlonScript)
{
throw new Exception("script not eqal ethalon script");
}
}
Since PostScript is not supported in Aspose products, further processing is done by **third-party applications**.
For example:
Use ghostscript (//ghostscript.com/)
string baseFolder = Path.Combine("D:","3286");
string fileName = "image2.wmf";
string inputFileName = Path.Combine(baseFolder, fileName);
string scriptFileName = inputFileName + ".ps";
string outputPdfFileName = scriptFileName + ".pdf";
string ghostPath = "C:
Program Files (x86)
gs
gs8.61
bin
gswin32c.exe";
string script;
using (Image image = Image.Load(inputFileName))
{
script = ((WmfImage)image).GetPostScript();
}
File.WriteAllText(scriptFileName, script);
string cmdArguments = string.Format(" -sDEVICE=pdfwrite -o {0} {1}", outputPdfFileName, scriptFileName);
Process proc = System.Diagnostics.Process.Start(ghostPath, cmdArguments);
proc.WaitForExit(60000);using(Image image = Image.Load(“input.jpg”))
{
image.Save(“output.tiff”,new TiffOptions(TiffExpectedFormat.TiffJpegRgb));
} string baseFolder = Path.Combine("D:", "test");
string fontsFolder = Path.Combine(baseFolder, "fonts");
//创建字体文件夹
if (!Directory.Exists(fontsFolder))
{
Directory.CreateDirectory(fontsFolder);
}//
//复制字体到字体文件夹
string fontFile = Path.Combine(fontsFolder, "foo.ttf");
if (!File.Exists(fontFile))
{
File.Copy(Path.Combine(baseFolder, "foo.ttf"), fontFile);
}//
//设置字体路径
List fonts = new List(FontSettings.GetDefaultFontsFolders());
fonts.Add(fontsFolder);
FontSettings.SetFontsFolders(fonts.ToArray(), true);//
//打开图片
string inputFile = Path.Combine(baseFolder, "grinched-regular-font.psd");
string outputFile = inputFile + ".png";
using (Image image = Image.Load(inputFile))
{
PngOptions saveOptions = new PngOptions();
image.Save(outputFile, saveOptions);
}
//删除字体文件夹
Directory.Delete(fontsFolder,true); string baseFolder = "D:
";
string inputFileName = Path.Combine(baseFolder, "logotype.svg");
float scale = 10f;
using (Image image = Image.Load(inputFileName))
{
image.Save(inputFileName+".png", new PngOptions()
{
VectorRasterizationOptions = new SvgRasterizationOptions()
{PageSize = image.Size, ScaleX = scale, ScaleY = scale}
});
}*想要购买Aspose.Imaging正版授权的朋友可咨询哦~
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@ke049m.cn




数据库工具DataGrip v2025.2正式发布,新版本为 AI 聊天上下文附加数据库对象的功能等,欢迎下载最新版体验!
本文将介绍界面组件Telerik UI for WinForms在今年第三个重大版本2025 Q3中发布的新功能,欢迎下载最新版组件体验!
界面控件DevExpress WinForms v25.2将于今年年末左右更新,新版本将继续升级报表组件功能等,欢迎关注我们及时获取最新消息~
DevExpress WinForms控件v25.1日前已经全新发布,新版本的Ribbon、PDF Viewer(查看器)等组件功能全新升级等,欢迎下载最新版体验!
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@ke049m.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
半岛外围网上直营