Bug 60656 - EMF image support in slideshows
Summary: EMF image support in slideshows
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: 3.16-dev
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2017-01-26 20:38 UTC by Ghazi Triki
Modified: 2019-07-23 14:47 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Ghazi Triki 2017-01-26 20:38:45 UTC
Actually if a file contains an EMF or a WMF image, the image is not exported when trying to export it as PNG.
Comment 1 Tim Allison 2017-01-26 20:47:08 UTC
We just added a stub parser for EMF that focuses on text extraction and embedded document extraction (yes, a PDF or a WMF can be embedded in an EMF, yeeha!).  Always looking for patches for rendering...

If you're having problems with rendering WMF, please open a separate issue.  There is support for rendering WMF.

Thank you.
Comment 2 Ghazi Triki 2017-01-26 21:23:36 UTC
I can provide an example of the file I mentioned. Is it a good idea?
Comment 3 Javen O'Neal 2017-03-23 06:31:55 UTC
Sure, as long as the file is licensed under ASL 2.0 and under 1 MB (bugzilla's file attachment limit, I think), otherwise email it to the dev list or upload it to your github.

It might be a while before someone has time and is interested in rendering an EMF or WMF file, but would be a fun exercise.
Comment 4 Andreas Beeker 2018-12-16 18:22:57 UTC
Merged the hemf branch via r1849040

There are still rendering issues and EMF+ is only very rudimentary implemented, but most cases of the common crawl corpus pass, so I hope it doesn't affect the next release too much.

I keep the issue open while still adding functionality.
Comment 5 Andreas Beeker 2019-05-04 23:04:11 UTC
Add more records for EMF+ via r1858625
Furthermore there are now extractors method (getEmbeddings()) in HwmfPicture and HemfPicture available.
Comment 6 Andreas Beeker 2019-05-12 19:50:38 UTC
Add a few more records via r1859159
Comment 7 Andreas Beeker 2019-06-06 22:34:06 UTC
Add some EMF+ drawing methods via r1860732
Comment 8 Andreas Beeker 2019-06-23 22:22:54 UTC
Thanks to Michael Ford, who provided me a test deck with various *SL*/EMF/WMF rendering errors. Applied via r1861952

This patch contains the following fixes:
* changed the EMF/WMF/ImageRenderer API to use Dimension2D instead of Dimension, to cover cases where vector graphic patterns where below 1 pixel unit
* reordered image data loading in DrawPaint because EMF lazy loaded the image data and couldn't access it, when the stream was closed
* reset graphic context clipping after EMF pictures were processed
* inverted the logic for HSLF getForegroundColor()/getBackgroundColor() because of a bit mask handling error
* partly implemented WmfDibStretchBlt
* initialize the WMF viewport with the inner bounds, because some pictures in ANISOTROPIC mapping mode wouldn't be rendered correctly otherwise, i.e. either upside down or with an offset
* empty clippings on WmfTextOut are now ignored
* refactored the clipping handling in HwmfGraphics
* handled offsets/differences of innerBounds (bounds set via WMF records) to the placeable header
* Removed invalid ObjectTable marker of WmfOffsetClipRgn, WmfIntersectClipRect, WmfExcludeClipRect - they are processed immediately
* PPTX2PNG output files are now 1-based, so the file index matches the -slide parameter
* PPTX2PNG output file names can now be configured via -outfile and -outpat switch
* XSLF shapes with a background picture defined as pic element instead of the blip properties are also handled now
Comment 9 Andreas Beeker 2019-07-22 21:32:58 UTC
fix image dimensions via r1863602
Comment 10 Tim Allison 2019-07-23 14:47:25 UTC
Andi, I recently dumped emf and wmf from a batch of hwp files.  If you want Korean-language focused files to work with: