Bug 138455 - FILEOPEN DOCX VML cropped image horizontally shrunk (crop lost)
Summary: FILEOPEN DOCX VML cropped image horizontally shrunk (crop lost)
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: All All
: medium normal
Assignee: Attila Szűcs
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:docx, regression
Depends on:
Blocks: DOCX-OLE-Objects Regressions-imageHandling
  Show dependency treegraph
 
Reported: 2020-11-24 11:03 UTC by NISZ LibreOffice Team
Modified: 2024-04-30 13:02 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Word (41.36 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-11-24 11:03 UTC, NISZ LibreOffice Team
Details
Screenshot of the original document side by side in Word and Writer master (59.95 KB, image/png)
2020-11-24 11:04 UTC, NISZ LibreOffice Team
Details
wrong_background_object_size_min.docx: minimized to remove the OLE, header, etc. (27.53 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-04-17 17:08 UTC, Justin L
Details
wrong_background_object_size_header_tiff.docx: TIFF in header - works since 5.2 (107.45 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-04-17 18:51 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2020-11-24 11:03:39 UTC
Created attachment 167529 [details]
Example file from Word

This is a followup to bug #77685 
The example docx file contains an OLE object in the footer which has a replacement image. 
This used to appear horizontally shrunk to the left half of the page before 5.2, then it was full page width like in Word until 6.1.
Since then it is shrunk to the left half ot the page again.

Steps to reproduce:
    1. Open attached document

Actual results:
Background image covers left half of the document.

Expected results:
Background image covers all of the document.

LibreOffice details:
Version: 7.2.0.0.alpha0+ (x64)
Build ID: f313e27fb7f2d42247407e26e16f264e30f87ca5
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL

Additional Information: 

Bibisected using bibisect-win32-6.1 to:
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=8484e52675052848d2d3ffe07378ce2ad29fd288 
author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2018-05-11 00:22:06 +0900
committer	Tomaž Vajngerl <quikee@gmail.com>	2018-05-12 10:07:09 +0200

tdf#117427 missing API for determining and loading linked graphic

Adding CC to:  Tomaž Vajngerl
Comment 1 NISZ LibreOffice Team 2020-11-24 11:04:07 UTC
Created attachment 167530 [details]
Screenshot of the original document side by side in Word and Writer master
Comment 2 Xisco Faulí 2020-11-24 11:38:29 UTC
Verified in

Version: 7.1.0.0.beta1+
Build ID: e2cffcf55b04838abc7497f6c18518c7600b670b
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 3 Justin L 2022-03-08 09:01:49 UTC
repro 7.4+
Comment 4 Justin L 2023-05-18 13:04:58 UTC
repro 7.6+
Comment 5 Justin L 2024-04-17 14:33:53 UTC
repro 24.8+ with comment 0's wrong_background_object_size.docx

As mentioned, it started working in 5.2 with
commit bb646c1472d3b77066b01128baf1c9cafdb40233
Author: Miklos Vajna on Tue Apr 12 09:18:47 2016 +0200
    tdf#99135 VML import: handle image crop
Comment 6 Justin L 2024-04-17 17:08:25 UTC
Created attachment 193733 [details]
wrong_background_object_size_min.docx: minimized to remove the OLE, header, etc.

OLE is irrelevant to this bug. It just describes how the image was created. So I removed all OLE stuff from the document. The header is also irrelevant, so I moved the image into document.xml.

I verified that this minimized version is affected by the same 5.2 and 6.1 commits.
Comment 7 Justin L 2024-04-17 18:14:56 UTC
The document was loading OK again in 6.2.6, but broken again in 7.2.0 when reverting commit 1c04b5c97ca3b12e52ec55572da77f7b6636e34c
Author: Gabor Kelemen on Sun Jul 14 20:21:08 2019 +0200
    tdf#126310 Disable lazy loading of WMF images

So that suggests that GraphicHelper::importEmbeddedGraphic should include all of the wmf formats when avoiding bLazyLoad.
Comment 8 Justin L 2024-04-17 18:26:48 UTC
hmm - comment 0's document is not fixed by avoiding lazy load there. Perhaps it crops differently when it is in a header?
Comment 9 Justin L 2024-04-17 18:51:40 UTC
Created attachment 193734 [details]
wrong_background_object_size_header_tiff.docx: TIFF in header - works since 5.2

So being in the header seems to be a complicating factor, but it doesn't guarantee that cropping doesn't work - it works fine for PNG and even TIFF formats.