C# 导入 Adobe Illustrator (.AI) 文件渲染为位图?
任何人都知道如何加载 .AI 文件(Adobe Illustrator),然后将矢量光栅化/渲染为位图,以便我可以生成例如。是 JPG 还是 PNG?
如果可能的话,我想生成缩略图+渲染带有PNG透明背景的大版本。
当然,如果您知道 .AI 的规格,那么它是“可能的”,但是有人可以分享任何知识或代码吗?或者也许只是某些组件的链接?
请使用 C# .NET :o)
代码是最有趣的,因为我对读取向量点和绘制样条线一无所知。
Anyone knows how to load a .AI file (Adobe Illustrator) and then rasterize/render the vectors into a Bitmap so I could generate eg. a JPG or PNG from it?
I would like to produce thumbnails + render the big version with transparent background in PNG if possible.
Ofcause its "possible" if you know the specs of the .AI, but has anyone any knowledge or code to share for a start? or perhaps just a link to some components?
C# .NET please :o)
Code is most interesting as I know nothing about reading vector points and drawing splines.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我已经使用 Pdf2Png 进行了测试,它对于 .PDF 和 .ai 文件都可以正常工作。
但我不知道它如何与透明一起工作。
I Have Tested that with Pdf2Png and it worked fine with both .PDF and .ai files.
But I don't know how it will work with transparents.
好吧,如果 Gregory 是对的,ai 文件与 pdf 兼容,并且您可以使用 GPL 代码,那么有一个名为 GhostscriptSharp 是 Ghostscript 引擎的 .NET 接口,可以渲染 PDF。
Well, if Gregory is right that ai files are pdf-compatible, and you are okay with using GPL code, there is a project called GhostscriptSharp on github that is a .NET interface to the Ghostscript engine that can render PDF.
使用较新的 AI 版本,您应该能够将 PDF 转换为图像。有很多图书馆可以做到这一点,而且价格便宜,所以我会选择购买而不是在此基础上构建。如果您需要转换较旧的 AI 文件,那么一切都将失败。我不确定它们的格式是什么。
With the newer AI versions, you should be able to convert from PDF to image. There are plenty of libraries that do this that are cheap, so I would choose buy over build on this one. If you need to convert the older AI files, all bets are off. I am not sure what format they were in.
Illustrator.AiExportType.aiPNG24 可以设置为 JPEG,GIF,Flash,SVG 和 Photoshop 格式。
Illustrator.AiExportType.aiPNG24 can be set as JPEG,GIF,Flash,SVG and Photoshop format.