Bug 142805 - DOCX image lost on roundtrip
Summary: DOCX image lost on roundtrip
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:docx, regression
Depends on:
Blocks: DOCX-Images OOXML-support-crop-shape-regressions
  Show dependency treegraph
 
Reported: 2021-06-11 20:10 UTC by Regina Henschel
Modified: 2024-02-09 11:13 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
testdocument (14.37 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-06-11 20:10 UTC, Regina Henschel
Details
The example file in Word, 7.0 and 7.1 side by side (293.97 KB, image/png)
2021-08-16 13:14 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2021-06-11 20:10:43 UTC
Created attachment 172827 [details]
testdocument

Open attached file. It belongs to test testEffectExtent in ooxmlexport.cxx in sw.

The document should show an image with reflection effect. Instead there is a default custom shape. Save the file to docx and reopen again. The custom shape is not visible.

Expected: LibreOffice shows an image, currently without reflection, because that is not yet implemented.
Comment 1 Telesto 2021-06-11 20:29:25 UTC
Repro
Version: 7.1.0.0.beta1+ (x64)
Build ID: f9fab4203c1aa0b9a3f27ce2713b6d5addc7df19
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: nl-NL (nl_NL); UI: nl-NL
Calc: CL
Comment 2 Telesto 2021-06-11 20:30:02 UTC
And with
Version: 7.2.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: 239b4bb27fd8db26e8416045b3015688a8b1b0ae
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 3 Telesto 2021-06-11 20:34:43 UTC
broken bit differently
Version: 6.4.0.0.beta1+ (x64)
Build ID: 20be5cd0bdc57d812bf34a2debfe48caa51de881
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL

again differently positioned and wrong image (but export functioning)
Version: 6.3.7.0.0+ (x86)
Build ID: 726535ec30f12697ceccd2f0640d9371a64dc5bd
CPU threads: 4; OS: Windows 6.3; UI render: default; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL

everything as expected (opening & export)
Version: 6.2.0.0.alpha0+
Build ID: b1d1edff4e81a8299e2a17c7e562d144329549ab
CPU threads: 4; OS: Windows 6.3; UI render: GL; 
Locale: nl-NL (nl_NL); Calc: CL
Comment 4 BogdanB 2021-07-31 05:33:26 UTC
Also in
Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 5aa74aa1e6fac571f99146ebcb6adc9feb1459ad
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-07-28_19:35:14
Calc: threaded
Comment 5 NISZ LibreOffice Team 2021-08-16 13:14:07 UTC
Created attachment 174320 [details]
The example file in Word, 7.0 and 7.1 side by side

This mirroring effect got broken sometime in 7.1, although the images positioning got better and the image content was not good before either.
Comment 6 Aron Budea 2021-08-28 01:33:30 UTC
The image loss on roundtrip started with the following commit in 7.1, bibisected to its 7.0 backport using repo bibisect-linux-64-7.0.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=9fe881410909c5273cef517433411bc4eceee294
author		Gülşah Köse <gulsah.kose@collabora.com>	2020-08-23 22:32:53 +0300
committer	Gülşah Köse <gulsah.kose@collabora.com>	2020-08-24 16:20:37 +0200

"tdf#134174 Fix the rotation of bitmap filled custom shapes."

Previously the rotated shape was mispositioned, it had an overlay of the unrotated LO logo (which didn't get lost on RT). This itself is a regression, and before the following commit in 6.2, the rotated logo looked correct.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=8af919d30f0f17a17ee6f5190bb31652476a52df
author		Tamas Bunth <tamas.bunth@collabora.co.uk>	2019-05-13 01:02:07 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	2019-05-15 09:26:00 +0200

ooxml import: supprt cropping to shape
Comment 7 Aron Budea 2021-08-28 01:36:18 UTC
(In reply to Aron Budea from comment #6)
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=8af919d30f0f17a17ee6f5190bb31652476a52df
> 
> ooxml import: supprt cropping to shape
Actually, that is a backported commit, this is the original in 6.3:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=f4ba484183a1e7b9824f10580d633466c266828f
Comment 8 QA Administrators 2024-02-09 03:13:35 UTC Comment hidden (obsolete)
Comment 9 Regina Henschel 2024-02-09 11:13:31 UTC
It is better in LO 24.2, but still needs improvement.

The image is cropped to a round rectangle in Word. Such cropping does not yet exist in LibreOffice. Therefore it is imported as round rectangle with bitmap fill. But the fill does not rotate together with the shape, so the import uses a rotated image as fill. The so rotated image has a bad quality and changing the rotation of the shape will not change the rotation of the image. The export does not restore the original image.

Ideas to improve the situation:
(1) Keep the original image and restore it when save as docx.
(2) Use the original, upright image as fill, set the shape in extrusion mode with zero depth and orthographic front. Then rotate the shape. The fill rotates together with the shape in extrusion mode. This works in principle but is currently only usable for images without transparency because of bug 159515.
(3) Insert the image as image and do the crop with a contour polygon. Such contour polygon is available for Writer-images but not for Draw-images. So task would be to implement contour polygon for Draw-images.