Bug 167641 - Image is visible in MS Word 365 but not in LO Writer 25.2.4.3 x86
Summary: Image is visible in MS Word 365 but not in LO Writer 25.2.4.3 x86
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.2.4.3 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: EMF-WMF
  Show dependency treegraph
 
Reported: 2025-07-23 06:20 UTC by tom1williams
Modified: 2025-07-25 11:39 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Figure 1 is not visible in LO Writer 25.2.4.3 (637.66 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-07-23 06:22 UTC, tom1williams
Details
EMF Parser EMR records list (197.36 KB, image/png)
2025-07-23 11:36 UTC, Piotr Osada
Details
The problem image1.emf EMF+ from the OOXML Word document (987.82 KB, image/x-emf)
2025-07-23 13:20 UTC, V Stuart Foote
Details
emf-dump.py dump of image1.emf (3.69 KB, text/plain)
2025-07-24 13:33 UTC, Hossein
Details
PDF object embedded in EMF file (195.42 KB, application/pdf)
2025-07-24 13:38 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tom1williams 2025-07-23 06:20:36 UTC
Description:
Figure 1 in the attached file is visible in MS Word 365 but not in LO Writer 25.2.4.3 x86

Steps to Reproduce:
1.Open the attached file and notice that Figure 1 is not visible in LO Writer 25.2.4.3 x86.
2.Open the attached file and notice that Figure 1 is visible in MS Word 365. 
3.mark this bug report as verified

Actual Results:
Figure 1 in the attached file is visible in MS Word 365 but not in LO Writer 25.2.4.3 x86

Expected Results:
Figure 1 in the attached file is visible in BOTH MS Word 365 and in LO Writer 25.2.4.3 x86


Reproducible: Always


User Profile Reset: No

Additional Info:
This problem has occurred to me twice recently with different figures from different MS Word .docx files. Has a new image format become popular in MS software just recently?
Comment 1 tom1williams 2025-07-23 06:22:22 UTC
Created attachment 201946 [details]
Figure 1 is not visible in LO Writer 25.2.4.3

Figure 1 is not visible in LO Writer 25.2.4.3
Comment 2 Jessica 2025-07-23 07:43:51 UTC
I can confirm it in

Version: 25.2.5.2 (X86_64) / LibreOffice Community
Build ID: 03d19516eb2e1dd5d4ccd751a0d6f35f35e08022
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (de_DE); UI: en-US
Calc: threaded

and in

Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 7f4868348c14b305fcd75744e1e3544d0d3a5d61
CPU threads: 16; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: threaded
Comment 3 Piotr Osada 2025-07-23 11:17:22 UTC
Tom, how this image was made, in which software?
Comment 4 Piotr Osada 2025-07-23 11:36:03 UTC
Created attachment 201951 [details]
EMF Parser EMR records list

It looks like there is something wrong with embedded "image1.emf" in:
..\072225 Newsletter for Research Note on CPO conference.docx\word\media\

ACDSee Ultimate 10, which normally shows EMF, don't show anything.
Winking 'Kyktir' can't show any EMR Records.
https://winking.be/en/products/kyktir

Paint and Word displays correctly.

Best knowledge about what is inside this file I have gained with:

'EMF Parser' for Windows By Bob Dong
https://download.cnet.com/download/emf-parser/3000-2383_4-10558240.html

(There are only 4 EMR RECORDS showed)

FOLLOWING ARE INFO'S FROM EACH 'EMF PARSER' ***'SECTIONS'***:




***Header***

EMF Header Info

filename:	C:\..\image1.emf
iType:	1
nSize:	108
rclBounds:	(0, 0) - (575, 351)
rclFrame:	(0, 0) - (11454, 6992)
dSignature:	0x464D4520
nVersion:	0x00010000
nBytes:	1011524
nRecords:	3
nHandles:	1
sReserved:	0
nDescription:	0
offDescription:	0
nPalEntries:	0 (0x0000)
szlDevice:	1728, 1117
szlMillimeters:	344, 222




***Records***


EMF Records List

Number of Records: 4

	iType	nSize	Data
----------------------------
0	EMR_HEADER
1	EMR_GDICOMMENT	
2	EMR_GDICOMMENT
3	EMR_EOF	0x0010(16)




***GDI calls***


EMF GDI Calls 

Number of Calls: 2

1	GdiComment(████████);
2	GdiComment(████████);
Comment 5 tom1williams 2025-07-23 12:09:44 UTC
(In reply to Piotr Osada from comment #3)
> Tom, how this image was made, in which software?

A colleague of mine thinks it is PowerPoint 365 Drawing but we have no proof of that. I think what my colleague really means is when it came to her it was already in a PowerPoint slide.
Comment 6 V Stuart Foote 2025-07-23 13:20:21 UTC
Created attachment 201952 [details]
The problem image1.emf EMF+ from the OOXML Word document

Document opens with image error triangle on Google docs. Draw, IrfanView, Inkscape all balk. ImageMagick identify says it is an EMF

C:\temp>identify image1.emf
image1.emf EMF 576x353 576x353+0+0 16-bit sRGB 0.003u 0:00.002

Only MS Paint opens, but it presents as a low res image. An EMF+ "preview" image?

So, suspect this is an EMF+ issue with the source image and => NOB.
Comment 7 tom1williams 2025-07-23 13:29:42 UTC
(In reply to V Stuart Foote from comment #6)
> Created attachment 201952 [details]
> The problem image1.emf EMF+ from the OOXML Word document
> 
> Document opens with image error triangle on Google docs. Draw, IrfanView,
> Inkscape all balk. ImageMagick identify says it is an EMF
> 
> C:\temp>identify image1.emf
> image1.emf EMF 576x353 576x353+0+0 16-bit sRGB 0.003u 0:00.002
> 
> Only MS Paint opens, but it presents as a low res image. An EMF+ "preview"
> image?
> 
> So, suspect this is an EMF+ issue with the source image and => NOB.

I think something in MSO365 created that image and I know for sure that MSO365 Word displays it correctly so I hope for compatibility sake that LO Writer should be able to display it and when the document is exported to a PDF by LO Writer it should display there also but it does not.
Comment 8 V Stuart Foote 2025-07-23 13:50:02 UTC
@Xisco, one for you?
Comment 9 Hossein 2025-07-24 13:33:58 UTC
Created attachment 201978 [details]
emf-dump.py dump of image1.emf

In this blog post, one can find some tools that help understand WMF/EMF/EMF+ file formats:

Supporting metafile formats: WMF/EMF/EMF+
https://dev.blog.documentfoundation.org/2022/04/26/supporting-metafile-formats-wmf-emf-emfplus/

If you open the file with Limerest, you will see two objects embedded inside the EMF file:

1. ImageAttributes, Size=0x24, 36 bytes
2. Image, Size=0xc6028, 811048 bytes, Type=Bitmap

If you try mso-dumper over the EMF file using emf-dump.py, you will get the attached file. This part is informative:

<emrFormat index='0'>
<Signature value="0x50444620" name="PDF "/>
<Version value="0x0"/>
<SizeData value="200105"/>
<offData value="44"/>
</emrFormat>

It suggests that the attached object is a PDF file.
Comment 10 Hossein 2025-07-24 13:38:21 UTC
Created attachment 201979 [details]
PDF object embedded in EMF file

If you look into image1.emf using a text editor (also visible in attachment 201951 [details]), you will see %PDF in second EMR_GDICOMMENT.

PDF can be extracted with:

dd if=image1.emf bs=1 skip=811400 count=200105 of=extracted.pdf

PDF file size is ~200KB, and LibreOffice can open it without issues.
Comment 11 V Stuart Foote 2025-07-24 14:33:58 UTC
(In reply to Hossein from comment #10)
> Created attachment 201979 [details]
> PDF object embedded in EMF file

I tried the other route and simply printed the EMF+ to PDF on Windows (via Win File Explorer but it uses MS Paint calls) and result is same low resolution that MS Paint had managed to open the EMF+

Hossein's direct dd dump extraction of the PDF from the EMF+ (attachment 201979 [details]) is *much sharper*, though about 2 times larger file size than the MS Print to PDF method.

Is MSO365 or Office or Word v17 (2019, 2021, 2024) dumping out the GDICOMMENT_IDENTIFIER of the PDF at higher resolution than MS Paint will? Or do they give the same low res rendering that MS Paint manages?

Either way, seems like we maybe ought to be able to parse a PDF image out of an EMF+ and bring it in. Either as BMP raster (libemf/pdfium) or as draw objects (poppler -> cairo).
Comment 12 Hossein 2025-07-24 14:53:39 UTC
(In reply to Hossein from comment #9)
> If you open the file with Limerest, you will see two objects embedded inside
> the EMF file:
> 
> 1. ImageAttributes, Size=0x24, 36 bytes
> 2. Image, Size=0xc6028, 811048 bytes, Type=Bitmap
I should clarify that the PDF file is not the above bitmap object in the first GDIComment. It is in the second GDIComment. In Limerest, the details inside this second record is not shown.

In msodumper, one can look into appropriate EMR_COMMENT record:

<record index="2" type="EMR_COMMENT">
  <Type value="0x46"/>
  <Size value="200164"/>
  <DataSize value="200149"/>
  <CommentIdentifier value="0x43494447" name="EMR_COMMENT_PUBLIC"/>
  <emrCommentPublic>
    <PublicCommentIdentifier value="0x40000004" name="EMR_COMMENT_MULTIFORMATS"/>
    <emrCommentMultiFormats>
      <OutputRect type="RectL">
        <Left value="0"/>
        <Top value="0"/>
        <Right value="0"/>
        <Bottom value="0"/>
      </OutputRect>
      <CountFormats value="0x1"/>
      <emrFormat index="0">
        <Signature value="0x50444620" name="PDF "/>
        <Version value="0x0"/>
        <SizeData value="200105"/>
        <offData value="44"/>
      </emrFormat>
    </emrCommentMultiFormats>
  </emrCommentPublic>
</record>
Comment 13 Hossein 2025-07-24 15:00:15 UTC
(In reply to V Stuart Foote from comment #11)
> Either way, seems like we maybe ought to be able to parse a PDF image out of
> an EMF+ and bring it in. Either as BMP raster (libemf/pdfium) or as draw
> objects (poppler -> cairo).
For supporting embedded PDF inside EMF file, I am looking into emfio/source/reader/emfreader.cxx, and specifically  "EmfReader::ReadMultiformatsComment()". It seems that some support for reading PDF is there. The code is written by Miklos, so he can probably give insight about the status of such support.

@Miklos: could you please take a look and see if this a bug, or lack of support?
Comment 14 tom1williams 2025-07-24 17:06:47 UTC
The image was high resolution when I viewed it in someone's MSO365 Word. Then I had a colleague who uses the WPS suite from Kingsoft and their word processor also displayed this image in high resolution. 

By the way thank you everybody! I am overwhelmed and grateful for all the attention you have paid to my bug ticket.