https://bugs.documentfoundation.org/show_bug.cgi?id=144167

Usiel Amaral <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
         Resolution|DUPLICATE                   |---
     Ever confirmed|0                           |1

--- Comment #39 from Usiel Amaral <[email protected]> ---
Reproduced with LibreOffice Draw 26.2.6.3 on Ubuntu 26.04.1 LTS.
Ubuntu package: 4:26.2.6.3-0ubuntu0.26.04.2.

This appears related to bug 144167. Please advise if it should be reported
separately.

Steps to reproduce:
1. Open the attached original ODG document.
2. The page is 33 x 11.27 cm, with 1 cm margins on all four sides.
3. Export the whole page (not the selection) to PNG, with transparency enabled
and pixel dimensions 755 x 258.
4. Export the same page to JPEG at 755 x 258 for comparison.

Actual result:
Both images have the requested pixel dimensions, but the drawing inside the
transparent PNG is stretched, particularly vertically, and the page margins are
not preserved correctly. The JPEG keeps the expected proportions.

Expected result:
Transparent PNG export should preserve the full page extent, all page margins,
and the proportions and positions of the drawing, consistently with JPEG
export.

Additional reproduction:
The distortion also occurs with headless export using a separate temporary
LibreOffice user profile and draw_png_Export with PixelWidth=755,
PixelHeight=258 and Translucent=true. This makes a user-profile-specific
setting less likely.

Investigation / proposed fix (NOT compiled or validated):
In svx/source/unodraw/UnoGraphicExporter.cxx, GraphicExporter::GetGraphic(),
the metafile export branch sets aNewOrg to the top-left page margins and
subtracts all four margins from aNewSize. For transparent raster export,
GetBitmapFromMetaFile then renders this reduced area at the requested full-page
pixel dimensions. This appears to explain the unequal horizontal and vertical
scaling.

The attached tentative patch uses origin (0,0) and the full page size when
mbTranslucent is true, leaving the existing vector-export bounds unchanged. It
needs developer review, compilation and regression testing. It is a proposed
correction, not a verified fix.

Attachments:
- original-with-margins.odg: original document, margins unchanged
- logoh.png: distorted transparent PNG export
- logoh.jpg: JPEG comparison
- libreoffice-png-preservar-margens.patch: tentative source change

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to