Bug 156525 - Save as > HTML or direct gif export loses drawing objects, charts and formulas as invalid gif
Summary: Save as > HTML or direct gif export loses drawing objects, charts and formula...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha1+
Hardware: All All
: high normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0 target:7.6.3
Keywords: bibisected, bisected, filter:html, regression
: 157544 (view as bug list)
Depends on:
Blocks: (X)HTML-Export Graphics-Export
  Show dependency treegraph
 
Reported: 2023-07-29 22:25 UTC by Stéphane Guillou (stragu)
Modified: 2023-10-23 11:18 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
sample ODT with various objects to save as HTML (74.80 KB, application/vnd.oasis.opendocument.text)
2023-10-04 16:06 UTC, Stéphane Guillou (stragu)
Details
after 7.6.3 patch, comparison original (left) and saved as HTML (right) (167.73 KB, image/png)
2023-10-04 16:07 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Guillou (stragu) 2023-07-29 22:25:50 UTC
Steps:
1. Open Writer
2. Insert a shape (like default rectangle)
3. File > Save as > HTML (Writer)
4. Reload

Result: shape is turned into an invalid gif that contains only what looks like a header. Does not happen to e.g. images.

Version: 7.6.0.1 (X86_64) / LibreOffice Community
Build ID: 776eaf34564cbf3f034a0ba1fd1d5c32ff9ccf1c
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

In 7.5.5.2, it was still exported as a valid gif that looks like the original.

Bibisected with linux-64-7.6 repo to first bad commit 44be93e1fe3e2bc1edb3cb832443d21a41cdcff4 which points to core commit:

commit 1c7cbd685633d44eac554629572f3401c450f855
author	Noel Grandin Sun May 07 16:56:21 2023 +0200
committer	Noel Grandin Sun May 07 20:17:16 2023 +0200
use AlphaMask for variables when calling GetAlphaMask
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151463

Noel, can you please have a look?

(in my opinion, such vector objects should really be exported as SVGs but that's a different story)
Comment 1 Stéphane Guillou (stragu) 2023-07-29 22:37:22 UTC
Had already been noticed by Gabor in bug 142887 comment 4.
Comment 2 Commit Notification 2023-08-02 16:22:42 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f76acf9bd97e65ba50303b6e5a25e5877996ebe1

tdf#156525 Save as > HTML loses drawing object as invalid gif

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Stéphane Guillou (stragu) 2023-08-09 13:54:25 UTC
Thank you Noel, fix verified in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 42364fbfafaa95773c073cc080142b64ec1786fb
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Ok to cherrypick to 7.6?
Comment 4 Stéphane Guillou (stragu) 2023-09-30 20:45:28 UTC
(also repro on macOS with 7.6.2.1)

(In reply to Stéphane Guillou (stragu) from comment #3)
> Ok to cherrypick to 7.6?

I see that the commit caters for some transparency->alpha stuff, so I assume it's not OK to cherrypick as-is.

Any chance for a reduced fix for 7.6, Noel? The issue doesn't affect just shapes: formulas, QR codes and fontworks are also lost.
Comment 5 Stéphane Guillou (stragu) 2023-10-01 17:28:15 UTC
*** Bug 157544 has been marked as a duplicate of this bug. ***
Comment 6 Stéphane Guillou (stragu) 2023-10-01 17:50:58 UTC
As in duplicate bug 157544, also affect direct export of object (like a chart) to gif.
Comment 7 Noel Grandin 2023-10-02 09:36:41 UTC
(In reply to Stéphane Guillou (stragu) from comment #4)
> 
> Any chance for a reduced fix for 7.6, Noel? The issue doesn't affect just
> shapes: formulas, QR codes and fontworks are also lost.

Cherry pick at https://gerrit.libreoffice.org/c/core/+/157457
Comment 8 Commit Notification 2023-10-02 13:38:56 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/f22c23e71d4ae628e9e90ee98d22d1fc8fca1619

tdf#156525 Save as > HTML loses drawing object as invalid gif

It will be available in 7.6.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Stéphane Guillou (stragu) 2023-10-04 16:06:31 UTC
Created attachment 190009 [details]
sample ODT with various objects to save as HTML

Thanks Noel, but I just tested a 7.6.3 build that includes your patch but I still get wrong gifs as an output.
Can you please test with the attached document in the 7.6 branch?

Version: 7.6.3.0.0+ (X86_64) / LibreOffice Community
Build ID: ba808a28f5ea365eaf8fe5d9c7c91b417633d75f
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 10 Stéphane Guillou (stragu) 2023-10-04 16:07:27 UTC
Created attachment 190010 [details]
after 7.6.3 patch, comparison original (left) and saved as HTML (right)
Comment 11 Commit Notification 2023-10-23 11:18:58 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/fbb5ab3e0ecb862fa5c48ef4640859c4aeb77984

tdf#156525 Save as > HTML loses drawing object as invalid gif

It will be available in 7.6.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.