Bug 160571 - FILEOPEN: Cropped SVG in .docx file (from winword) is rendered uncropped in Writer
Summary: FILEOPEN: Cropped SVG in .docx file (from winword) is rendered uncropped in W...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 beta1+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Images
  Show dependency treegraph
 
Reported: 2024-04-06 20:14 UTC by Fredrik Stock
Modified: 2024-05-21 05:42 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample document from WinWord (29.14 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-04-06 20:19 UTC, Fredrik Stock
Details
PDF export from Writer showing the problem (3.54 KB, application/pdf)
2024-04-06 20:21 UTC, Fredrik Stock
Details
Screenshot of the document in WinWord (11.05 KB, image/png)
2024-04-06 20:21 UTC, Fredrik Stock
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fredrik Stock 2024-04-06 20:14:17 UTC
Description:
When a full-sized SVG image is cropped inside a word document, the original image remains in the docx zip and the cropping is done with <a:srcRect .../> in the document source.

Sometime after 7.6 (problem not present in that version) Writer ignores the cropping and renders the full SVG. The resizing persists, so the vector image is thus smooshed too.

Steps to Reproduce:
1. Winword: Insert an SVG image in a new doc
2. Winword: Crop the SVG, save the document
3. Writer: Open saved document

Actual Results:
The cropped SVG is rendered uncropped. Size transformations are still applied.

Expected Results:
Image should be rendered cropped.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
This does not occur with SVG files added and cropped in Writer.

Diff between the relevant xml nodes of a file from Writer and a file from Winword:

diff --git "a/.\\graphic-winword.xml" "b/.\\graphic-writer.xml"
index 553310a..02081ca 100644
--- "a/.\\graphic-winword.xml"
+++ "b/.\\graphic-writer.xml"
@@ -2,36 +2,32 @@
   <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
     <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
       <pic:nvPicPr>
-        <pic:cNvPr id="1554685201" name=""/>
-        <pic:cNvPicPr/>
+        <pic:cNvPr id="1" name="Image1" descr="" title=""></pic:cNvPr>
+        <pic:cNvPicPr>
+          <a:picLocks noChangeAspect="1" noChangeArrowheads="1"/>
+        </pic:cNvPicPr>
       </pic:nvPicPr>
-      <pic:blipFill rotWithShape="1">
+      <pic:blipFill>
         <a:blip r:embed="rId2">
           <a:extLst>
             <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}">
               <asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId3"/>
             </a:ext>
           </a:extLst>
         </a:blip>
-        <a:srcRect l="58314"/>
-        <a:stretch/>
+        <a:srcRect l="49787" t="0" r="0" b="0"/>
+        <a:stretch>
+          <a:fillRect/>
+        </a:stretch>
       </pic:blipFill>
       <pic:spPr bwMode="auto">
         <a:xfrm>
           <a:off x="0" y="0"/>
-          <a:ext cx="2319220" cy="3262862"/>
+          <a:ext cx="2901315" cy="3387725"/>
         </a:xfrm>
         <a:prstGeom prst="rect">
           <a:avLst/>
         </a:prstGeom>
-        <a:ln>
-          <a:noFill/>
-        </a:ln>
-        <a:extLst>
-          <a:ext uri="{53640926-AAD7-44D8-BBD7-CCE9431645EC}">
-            <a14:shadowObscured xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"/>
-          </a:ext>
-        </a:extLst>
       </pic:spPr>
     </pic:pic>
   </a:graphicData>
Comment 1 Fredrik Stock 2024-04-06 20:19:18 UTC
Created attachment 193551 [details]
Sample document from WinWord
Comment 2 Fredrik Stock 2024-04-06 20:21:05 UTC
Created attachment 193552 [details]
PDF export from Writer showing the problem
Comment 3 Fredrik Stock 2024-04-06 20:21:38 UTC
Created attachment 193553 [details]
Screenshot of the document in WinWord
Comment 4 m_a_riosv 2024-04-07 21:17:03 UTC
Reproducible
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5ebdcc60701ca5f2d267f92fa69ac06202309c52
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
Comment 5 Stéphane Guillou (stragu) 2024-05-21 05:34:57 UTC
This is a regression in 24.2.

Reproduced in:

Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 433d9c2ded56988e8a90e6b2e771ee4e6a5ab2ba
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Version: 24.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: d0702a3f17c1fbd1b8ffb9ca0b275943e1a1f442
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

Bibisected with linux-64-24.2 repo to first bad build [18a81415c56f2c4c6dde248db2fb2bc382b247d8] which is:

commit 1db193c6c744289139b1df2af0b8defcf974b238
author	Tomaž Vajngerl 	Mon Sep 25 09:03:54 2023 +0200
committer	Tomaž Vajngerl 	Wed Dec 06 08:23:34 2023 +0100
tdf#126084 import svg image from ooxml document that use svgBlip elem.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157238

Quikee, can you please have a look?
Comment 6 Stéphane Guillou (stragu) 2024-05-21 05:42:50 UTC
Ah, the SVG is now shown instead of the PNG fallback. So I guess your commit made a pre-existing issue visible?