Bug 105998 - right/bottom borders of export shape to png (etc) missing
Summary: right/bottom borders of export shape to png (etc) missing
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Armin Le Grand
URL:
Whiteboard: target:5.4.0 target:6.1.0 target:6.2....
Keywords:
: 82636 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-02-14 10:00 UTC by Caolán McNamara
Modified: 2023-02-04 19:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
demo (7.65 KB, application/vnd.oasis.opendocument.graphics)
2017-02-14 10:01 UTC, Caolán McNamara
Details
everything ok; this is generated file (911 bytes, image/png)
2018-09-16 14:47 UTC, BogdanB
Details
Sample ODG file (8.40 KB, application/vnd.oasis.opendocument.graphics)
2021-12-06 23:47 UTC, Rafael Lima
Details
Resulting PNG file (1.06 KB, image/png)
2021-12-06 23:49 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Caolán McNamara 2017-02-14 10:00:37 UTC
Description:
missing borders on export of selection to png

Steps to Reproduce:
1. open document
2. select image
3. export, select "selection", export to png

Actual Results:  
missing right/bottom borders

https://bz.apache.org/ooo/show_bug.cgi?id=122820 is similar

Expected Results:
borders visible in export


Reproducible: Always

User Profile Reset: No

Additional Info:
bmp "works" cause it uses a different export mode where its slightly scaled down to fit the right/bottom border into the canvas


User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Comment 1 Caolán McNamara 2017-02-14 10:01:09 UTC
Created attachment 131203 [details]
demo
Comment 2 Caolán McNamara 2017-02-14 10:07:20 UTC
I have a workaround, if its a good idea or not I'm not 100% sure though https://gerrit.libreoffice.org/#/c/34243/
Comment 3 Commit Notification 2017-03-13 15:30:01 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=512afb41899a78f1e19ba79f237608aec15cc8bc

Resolves: tdf#105998 distort hairline borders to fall inside the canvas

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Caolán McNamara 2017-04-11 10:41:03 UTC
*** Bug 82636 has been marked as a duplicate of this bug. ***
Comment 5 Commit Notification 2017-12-06 09:02:51 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=15cdcd0346b7aa98d4697edec8aeea9c810efa62

Related: tdf#105998 except cut and paste as bitmap instead of export

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Armin Le Grand 2017-12-07 09:38:05 UTC
@Caolan: This is one of the problems with Hairlines, see PolygonHairlinePrimitive2D::getB2DRange. Basic prob is that hairlines are view-dependent in their size - dependent of ViewTransformation. Thus they always have to be handled dependent on ViewTransformation aka MapMode in OutDev. HTH!
Comment 7 Armin Le Grand 2018-08-16 15:10:35 UTC
Unfortunately is in the way now. Checked, can be better fixed in GetBitmapFromMetaFile. The problem is specific to Metafile data having Hairlines on their right/bottom. The non-bTransparent path is already using GDIMetaFile::GetBoundRect that differentiates between Rectanges for content and hairline - already fixing this path in that case.
This is the right place to do - it's a GDIMetaFile-specific error. Doing it in the VclPixelProcessor2D is not good in the long run. Anyways - basegfx::utils::distort does work, but is intended to deform geometry interactively in Draw...
Comment 8 Armin Le Grand 2018-08-16 18:24:17 UTC
Suggestion is at https://gerrit.libreoffice.org/#/c/59220/
Comment 9 Commit Notification 2018-08-17 19:28:04 UTC
Armin Le Grand committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=046df0a876b3d948bb1e14443c00c180bc8cccaa

tdf#105998: Enhanced fix for MetafileToBitmap at better place

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Armin Le Grand 2018-08-21 10:18:25 UTC
Updated, checked, fixed.
Comment 11 BogdanB 2018-09-16 14:47:41 UTC
Created attachment 144909 [details]
everything ok; this is generated file

I attached a generated .png, everything is as aspected.

tested on
Version: 6.2.0.0.alpha0+
Build ID: e005ab5d40d358adb75a64e140d46f4bf605647d
CPU threads: 4; OS: Linux 4.15; UI render: GL; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2018-09-15_02:08:38
Locale: ro-RO (ro_RO.UTF-8); Calc: threaded
Comment 12 DRC 2018-10-31 17:23:17 UTC
I still see a form of this bug in LibreOffice 5.4.4 and 6.0.6 when exporting a selection.  How to reproduce:

- Open https://github.com/TurboVNC/turbovnc/raw/master/doc/x11transport.odg
- Ctrl-A/Command-A to select all
- File --> Export
- File type: PNG
- Check "Selection"
- Click "Save"
- Enter "630" for width

If "Save transparency" is checked, then the right-hand border of the dashed rectangles is not present in the exported image.  If "Save transparency" is unchecked, then the exported image is correct.
Comment 13 Michael Picher 2020-01-28 15:38:45 UTC
Still occurring in 6.3.2 Draw...
Comment 14 Rafael Lima 2021-12-06 23:47:44 UTC
Created attachment 176751 [details]
Sample ODG file

This bug is still present in LO 7.3 beta 1.

Other users have reported PNG export problems where the bottom and left borders are missing some pixels when exporting the "selection" (bug 132590).

I attached a very simple ODG file with a rectangle and a thick border. If you select and export this rectangle, you'll notice that the bottom and left borders will be missing a few pixels.

In my experience, this PNG export bug has always existed.

Should we set this bug report to REOPENED ?
Comment 15 Rafael Lima 2021-12-06 23:49:20 UTC
Created attachment 176752 [details]
Resulting PNG file

This is the resulting PNG file. Note that the bottom and left borders are missing some pixels.

All tests were done with LO 7.3 beta 1.

Version: 7.3.0.0.beta1 / LibreOffice Community
Build ID: 436f14c25ec1847646b953cf13d0db4f7ca3be57
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: threaded
Comment 16 Caolán McNamara 2021-12-07 09:32:26 UTC
never reopen multi-year old closed bugs, file a new one and reference the old one.
Comment 17 Commit Notification 2022-02-01 18:27:17 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5d05abcc7cb53fd7f7d7ed700e3c65e9da3e5dea

tdf#105998: sd_png_export_tests: Add unittest

It will be available in 7.4.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.