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.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-06 20:14 UTC by Fredrik Stock
Modified: 2024-04-07 21:17 UTC (History)
1 user (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