Bug 158083 - FILESAVE RTF Images are saved twice
Summary: FILESAVE RTF Images are saved twice
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Vasily Melenchuk (CIB)
URL:
Whiteboard: target:24.2.0 target:7.6.4
Keywords:
Depends on:
Blocks: RTF-Images
  Show dependency treegraph
 
Reported: 2023-11-06 09:38 UTC by Gabor Kelemen (allotropia)
Modified: 2023-11-11 17:30 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
The original file saved with Writer master (922.44 KB, application/msword)
2023-11-06 09:39 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-11-06 09:38:21 UTC
This is a followup to bug 104288

When a file with images is saved as RTF, the images are saved twice.

1. Open attachment 126445 [details] from bug 101170 in Writer. It has a single image.
2. Save as RTF.
-> file size is roughly twice of the original. See: 
https://bugs.documentfoundation.org/show_bug.cgi?id=101170#c11
https://bugs.documentfoundation.org/show_bug.cgi?id=82033#c13

grepping the plain text shows what happens:

$ grep "\\pict" logo_only\(1\)*
logo_only(1).rtf:\plain\fs20\s15\tx7935\fs20\tx7935     \cf0{\*\shppict
logo_only(1).rtf:{\pict
logo_only(1)-LO242.rtf:{\pict{\*\picprop{\sp{\sn wzDescription}{\sv }}{\sp{\sn wzName}{\sv }}}\picscalex5\picscaley5\piccropl0\piccropr0\piccropt0\piccropb0\picw2944\pich1336\picwgoal44160\pichgoal20040\jpegblip
logo_only(1)-LO242.rtf:{\pict{\*\picprop{\sp{\sn wzDescription}{\sv }}{\sp{\sn wzName}{\sv }}}\picscalex5\picscaley5\piccropl0\piccropr0\piccropt0\piccropb0\picw2944\pich1336\picwgoal44160\pichgoal20040\jpegblip

two \pict sections instead of one.

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: a09b59cdbde2ab92bbbb6737337b74a7a62b17f1
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded
Comment 1 Gabor Kelemen (allotropia) 2023-11-06 09:39:15 UTC
Created attachment 190669 [details]
The original file saved with Writer master
Comment 2 Vasily Melenchuk (CIB) 2023-11-06 09:54:43 UTC
Confirmed with:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 257be962efc57a341617b214303b29bff2022c6a
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: en-US (C); UI: en-US
Calc: CL threaded


Second copy of image came because of strange table written into RTF: {\*\pgdsctbl ... }. As I see from sources it stores some page properties into this destination (including header/footer and image in this case). But \pgdsctbl - is not a standard RTF tag and RTF specification 1.9.1 has no info about it.

Looks like it is not read even by Writer these days. Looks like it should be safe to remove from export. But I want to investigate a reason for this.
Comment 3 Commit Notification 2023-11-07 14:00:00 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

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

tdf#158083: RTF: drop export for \pgdsctbl

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 4 Commit Notification 2023-11-11 17:30:06 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/1d16c19c47a5d0c679e88281e08d1548867170a1

tdf#158083: RTF: drop export for \pgdsctbl

It will be available in 7.6.4.

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.