Windows Metafile (WMF) and Enhanced MetaFile (EMF) are 2 linked image formats developed by Microsoft since the 1990s. Enhanced MetaFile is essentially an updated version of WMF which makes it 32 bit and addresses some other issues. Unlike most other image formats, it is a Vector file format.
While it can contain bitmap data, it mainly consists of shapes, lines and other Vector shapes. So it can be scaled or output to different devices such as printers which can draw the contents in much higher definition. In many ways, it is similar to PostScript, which was the predecessor to the PDF File Format.
EMF/WMF formats been developed and extensively supported by Microsoft, and it is the native Vector File format for Microsoft Office applications so many Companies have lots of WMF/EMF files. However, it was not extensively adopted by other platforms and most Browsers.
EMF/WMF file formats are similar to SVG, which is widely supported by browsers because it is a part of HTML5.
How to read EMF and WMF images in Java?
Why use JDeli to read EMF and WMF files?
JDeli offers a range of advantages over ImageIO and alternatives, including:
- prevents heap related JVM crashes
- implements unsupported image formats
- can convert EMF/WMF to SVG
- improved read performance
- supports threading
- superior image scaling algorithms
Read and write images in Java with one line of code
Read an Image with
BufferedImage image = JDeli.read(streamOrFile);
and write an Image with
JDeli.write(myBufferedImage, OutputFormat.HEIC, outputStreamOrFile)