需要使用 java 将 EMF 转换为 jpeg,png 文件格式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4861400/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Need to convert EMF to jpeg,png file formats using java
提问by vignesh
I need to convert the emf,wmf file formats to png or jpeg using full java code(since these formats are not supported in some browsers)..Can anybody guide me..
我需要使用完整的 Java 代码将 emf、wmf 文件格式转换为 png 或 jpeg(因为某些浏览器不支持这些格式)。任何人都可以指导我..
Thanks in advance
提前致谢
回答by Luciano Fiandesio
The fastest way is probably to use Imagemagick. It does supportthe EMF and WMF formats. I have used successfully Imagemagick from Java using im4java, an Java interface for Imagemagick.
最快的方法可能是使用Imagemagick。它确实支持EMF 和 WMF 格式。我已经使用im4java(Imagemagick 的 Java 接口)从 Java 成功使用了 Imagemagick。
Alternatively you can look at Jmagick, another Java interface for Imagemagick. I have found this one more complex to use.
或者,您可以查看Jmagick,这是 Imagemagick 的另一个 Java 接口。我发现这个使用起来更复杂。
回答by Adam Schmideg
Other options: FreeHEPand Apache Batik. I haven't tried them, though.
其他选项:FreeHEP和Apache Batik。不过我没试过。
回答by Leo
A pure-java solution is TwelveMonkeys with Batik supports reading WMF file.
纯 Java 解决方案是 TwelveMonkeys 与 Batik 支持读取 WMF 文件。
Batik can handle only old WMF with Aldus Placable Header, unable parsing for some other types (recently in MS Office metadata). See WMF formats: http://wvware.sourceforge.net/caolan/ora-wmf.html
Batik 只能处理带有 Aldus Placable Header 的旧 WMF,无法解析某些其他类型(最近在 MS Office 元数据中)。参见 WMF 格式:http: //wvware.sourceforge.net/caolan/ora-wmf.html
A workround provided in: https://github.com/haraldk/TwelveMonkeys/issues/35to wrap recent WMF with a "fake" Aldus Placable Header, then pass to Batik.
提供的解决方法:https: //github.com/haraldk/TwelveMonkeys/issues/35用“假”Aldus Placable Header 包装最近的 WMF,然后传递给 Batik。
Otherwise, ImageMagick (IM) is a simple solution with installer. BTW, even with recent IM, WMF could not be properly converted in Linux (return black image).
否则,ImageMagick (IM) 是一个带有安装程序的简单解决方案。顺便说一句,即使使用最近的 IM,WMF 也无法在 Linux 中正确转换(返回黑色图像)。
回答by AlexR
Fast investigation showed the following command line utility: http://www.verypdf.com/htmltools/html-converter/emf-to-bmp.html
快速调查显示以下命令行实用程序:http: //www.verypdf.com/htmltools/html-converter/emf-to-bmp.html
You can run it from java program. Unfortunately I have not seen pure java solution. Will be happy to know if one exists.
你可以从java程序运行它。不幸的是,我还没有看到纯 Java 解决方案。会很高兴知道是否存在。