Bug 152540 - RTF: Invalid scale for linked JPG images (INCLUDEPICTURE command)
Summary: RTF: Invalid scale for linked JPG images (INCLUDEPICTURE command)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.3.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: RTF-Images
  Show dependency treegraph
 
Reported: 2022-12-16 09:23 UTC by libreoffice
Modified: 2022-12-28 11:55 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Minimal working example (46.35 KB, application/x-zip-compressed)
2022-12-16 09:25 UTC, libreoffice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description libreoffice 2022-12-16 09:23:43 UTC
Description:
With Bug 59699, the INCLUDEPICTURE command has been partly fixed, such that RTF documents with a linked image will generally display the linked image.

However, it seems that only PNG files (such as the one linked in the attachment of the mentioned bug report) show up correctly, while (all/some?) JPG files are inserted as a tiny thumbnail only. Comment 14 of the mentioned bug also indicates this problem, but AFAIK, there has not been a follow-up bug report.

To reproduce, I created a 200x200 pixel sample image and saved it in PNG and JPG format. I created an RTF file with the following code:

{\rtf1
JPG {\field{\*\fldinst{ INCLUDEPICTURE "C:\\\\Temp\\\\sample.jpg" \\* MERGEFORMAT \\d}}{\fldrslt}} \par
PNG {\field{\*\fldinst{ INCLUDEPICTURE "C:\\\\Temp\\\\sample.png" \\* MERGEFORMAT \\d}}{\fldrslt}}
\par }

(Paths must be adjusted upon reproducing). When opening the file in MS Word, both pictures show up with the same size. When opening with LibreOffice Writer, the PNG shows up at its normal size, but the JPG is just a small, say 5x5 px, rectangle. When opening the properties of the JPG file, the size information is set to 0.04cm, but when clicking on "original size", the actual size of the image seems to appear and after that the PNG and JPG files are of the same size. I have also tried saving the raw RTF file quoted above as a LibreOffice RTF file. This will embed both images and I noticed that the \picscalex and \picscaley of the JPG is 0, but 100 for the PNG. Maybe this is the origin of the problem? The embedded picture headers are:

JPG: \picscalex0\picscaley0\piccropl0\piccropr0\piccropt0\piccropb0\picw200\pich200\picwgoal4050\pichgoal4050\jpegblip

PNG: \picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw200\pich200\picwgoal4049\pichgoal4049\pngblip

Steps to Reproduce:
1. Create sample image and save as PNG and JPG
2. Create RTF file linking both images (see MWE in the description)
3. Open RTF in LibreOffice writer

Actual Results:
PNG is displayed correctly, JPG is shown as very small thumbnail.

Expected Results:
Linked JPG and PNG show the same image with the same size.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.4.3.2 (x64) / LibreOffice Community
Build ID: 1048a8393ae2eeec98dff31b5c133c5f1d08b890
CPU threads: 16; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL
Comment 1 libreoffice 2022-12-16 09:25:02 UTC
Created attachment 184176 [details]
Minimal working example
Comment 2 Dieter 2022-12-28 11:55:14 UTC
I confirm the problem with

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 376152fbd110cdc0a2cde1fa9758f36c016d9352
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-GB
Calc: CL threaded

Steps:
1. Open sample_saved_with_writer from attachment 184176 [details]

cc: Miklos Vajna
Miklos, since you've fixed bug 59699, you might be interested in this