Bug 103903 - EMF import distorts proportion of image files (Landscape looks like Portrait)
Summary: EMF import distorts proportion of image files (Landscape looks like Portrait)
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:emf
: 113868 (view as bug list)
Depends on: 142571
Blocks: EMF-WMF
  Show dependency treegraph
 
Reported: 2016-11-13 13:00 UTC by Joerg
Modified: 2021-06-02 02:16 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Affected EMF file (41.59 KB, image/x-emf)
2016-11-13 13:01 UTC, Joerg
Details
HowItLooksInLO5.2.1.2 (151.16 KB, image/png)
2016-11-13 13:02 UTC, Joerg
Details
HowItLooksInIrfanView (115.56 KB, image/png)
2016-11-13 13:03 UTC, Joerg
Details
LO5.2.1.2_Writer_file_with_the_image_embedded (15.74 KB, application/vnd.oasis.opendocument.text)
2016-11-13 13:05 UTC, Joerg
Details
ScreenshotOfTheDistortedImageInLO_DEV_Version 6.0.0.0.alpha1_withNewEMF_implementation.PNG (117.45 KB, image/png)
2017-11-15 21:02 UTC, Joerg
Details
Affected EMF compared (210.79 KB, image/png)
2020-11-16 12:34 UTC, Timur
Details
Example java code to generate EMF files (14.73 KB, application/x-zip-compressed)
2021-06-01 23:02 UTC, Joerg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg 2016-11-13 13:00:05 UTC
Description:
Attached is an EMF Metafile which is shown with it's correct (Landscape) porportions in third party tools like MS Windows Paint or the free IrfanView.

If I open this file with LibreOffice Draw or embedd it in Writer using Insert->Image->FromFile the image has completley different porportions and looks ugly therefore.

Steps to Reproduce:
Just open the attached EMF file Landscape.emf in LibreOffice draw and compare it with the expected image proportins of the attached IrfanView screenshot.

Actual Results:  
Image size 8.89 x 13.59 cm (Portrait)

Expected Results:
Image size 21.1 x 15.3 cm (Landscape) or proportional to this ratio


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
Comment 1 Joerg 2016-11-13 13:01:35 UTC
Created attachment 128716 [details]
Affected EMF file
Comment 2 Joerg 2016-11-13 13:02:33 UTC
Created attachment 128717 [details]
HowItLooksInLO5.2.1.2
Comment 3 Joerg 2016-11-13 13:03:09 UTC
Created attachment 128718 [details]
HowItLooksInIrfanView
Comment 4 Joerg 2016-11-13 13:05:11 UTC
Created attachment 128719 [details]
LO5.2.1.2_Writer_file_with_the_image_embedded
Comment 5 Aron Budea 2016-11-14 06:12:24 UTC
Confirmed with as early as v3.3.0 / Windows 7.
Comment 6 QA Administrators 2017-11-15 09:15:30 UTC Comment hidden (obsolete)
Comment 7 Joerg 2017-11-15 21:02:26 UTC
Created attachment 137793 [details]
ScreenshotOfTheDistortedImageInLO_DEV_Version 6.0.0.0.alpha1_withNewEMF_implementation.PNG

This problem still occurs in the LO 6.0 nightly builds with the new EMF implementation! See the attached screenshot!
Comment 8 johan 2018-03-25 15:29:55 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2019-03-27 03:40:36 UTC Comment hidden (obsolete)
Comment 10 johan 2019-07-06 11:50:34 UTC
Tested aspect ratio distortion problem, see bug #116335 part 4), on Windows 7, 32-bit, with a clean installation of:

Version: 6.2.5.2 (x86)
Build ID: 1ec314fa52f458adc18c4f025c545a4e8b22c159
CPU threads 4; OS: Windows 6.1; Rendering component: default; VCL: win; 
Locale: fi-FI (fi_FI); UI Language: fi-FI
Calc: threaded


The problem still occurs.
Comment 11 johan 2019-07-06 12:06:38 UTC
Additionally, similar problem occurs in Inkscape (version 0.92-4 tested; problem already reported to Inkscape devs).
Comment 12 Timur 2020-11-16 12:34:30 UTC
Created attachment 167331 [details]
Affected EMF compared

Repro LO 7.1+ and also MSO 2016. Different and reported good in IrfanView.
Comment 13 Valek Filippov 2021-05-31 13:15:54 UTC
*** Bug 113868 has been marked as a duplicate of this bug. ***
Comment 14 Valek Filippov 2021-05-31 13:20:29 UTC
Looks like LO at some point became more bug-to-bug compatible with MSO.
The sample file is rendered with wrong ratio in MS Word and MS PowerPoint.

It renders right in MS Paint, Wordpad and some third party tools.
The way it renders in MS Paint/Wordpad looks more logical and consistent.

However, unless MS fix one or the other (or spec), the decision has to be made with what to be compatible.
Comment 15 Buovjaga 2021-06-01 19:01:59 UTC
Ok, let's close as it's MS chasing its own tail.
Comment 16 Joerg 2021-06-01 19:23:05 UTC
This bug report is not about MS Office! It's about broken EMF file support. These are native OpenDocument files with embedded EMF. These are native files, not files imported from MS Office!
Comment 17 Valek Filippov 2021-06-01 22:45:49 UTC
(In reply to Joerg from comment #16)
> This bug report is not about MS Office! It's about broken EMF file support.
> These are native OpenDocument files with embedded EMF. These are native
> files, not files imported from MS Office!

Could you please explain why LibreOffice should show this EMF as MS Paint and IfranView instead of showing it the same as MS Word or MS PowerPoint?
Comment 18 Bartosz 2021-06-01 22:49:52 UTC
(In reply to Joerg from comment #16)
> This bug report is not about MS Office! It's about broken EMF file support.
> These are native OpenDocument files with embedded EMF. These are native
> files, not files imported from MS Office!

@Joerg Do you remember by which application the EMF file was created?

We implemented current import code, according to [MS-EMF] specification.
Unfortunately MS Paint/Wordpad is displaying these images differently.

The issue with image from this ticket is:

Even if we provide the fix for this image, the other EMF images will start displaying incorrectly. That's why we currently don't see a solution to resolve this issue, without breaking import of other images.
Comment 19 Joerg 2021-06-01 22:57:31 UTC
As far as I can see, the file is correct EMF syntax and contains the correct aspect ratio.
The image import should take over the aspect ratio of the original file and should not assume, that the image file is broken. This might make sense when somebody imports a MS Office document containing an EMF generated by MS Office, but not in case of importing a standalone image which has no relation to MS Office.
Comment 20 Joerg 2021-06-01 23:02:23 UTC
Created attachment 172561 [details]
Example java code to generate EMF files
Comment 21 Joerg 2021-06-01 23:05:45 UTC
Hello Bartosz,

it's generate by a Java based OpenDocument generator which contains code similar to the attached example program.

KR Jörg
Comment 22 Valek Filippov 2021-06-02 02:16:46 UTC
(In reply to Joerg from comment #19)

> The image import should take over the aspect ratio of the original file and
> should not assume, that the image file is broken.
Nobody assumes that the file is broken.
It has some "specifics" which unfortunately not 100% clearly documented in the MS spec AND handled differently by different implementations.

> This might make sense when
> somebody imports a MS Office document containing an EMF generated by MS
> Office, but not in case of importing a standalone image which has no
> relation to MS Office.

There is no good way to differentiate an image generated by MS tools and imported as a standalone file and by other different third party tools, with each of them able of doing their own interpretation of the spec.

In the current situation LibreOffice need to choose which interpretation of the spec to support. MSO sounds more reasonable than MS Paint.

> it's generate by a Java based OpenDocument generator 
> which contains code similar to the attached example program.

If modification of this generator is an option, I could help to identify relatively small changes in the resulting EMF required to make it more compatible with different readers.