Bug 98954 - EXPORT to PNG: Page background transparency is lost in Writer
Summary: EXPORT to PNG: Page background transparency is lost in Writer
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.0.3.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL: https://ask.libreoffice.org/t/obtenti...
Whiteboard:
Keywords: bibisected
: 115508 (view as bug list)
Depends on:
Blocks: Writer-Enhancements Graphics-Export
  Show dependency treegraph
 
Reported: 2016-03-29 12:45 UTC by Eugene Markow
Modified: 2024-07-13 19:19 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample exported PNG image file (1200 W x 600 H) from Writer (71.67 KB, image/png)
2016-03-29 12:45 UTC, Eugene Markow
Details
Sampt ODT File from which exported image originated (17.42 KB, application/vnd.oasis.opendocument.text)
2016-03-30 10:54 UTC, Eugene Markow
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Markow 2016-03-29 12:45:11 UTC
Created attachment 123920 [details]
Sample exported PNG image file (1200 W x 600 H) from Writer

Writer fails to create the background image transparency of the "page no-fill" portion in an exported file. Attached is an exported sample file.

Procedures and settings:

"File -> Export" Example:

* Format -> Page -> Area -> Fill -> None (Width: 12.00 " Height 6.00 ")

* Properties of Inserted Image: White Background with Grey Border       (blank_white_box_1024x512.png)

* File -> Export -> lo_writer_image_export.png -> Save -> Resolution: 100 DPI -> OK

Result: Area outside of Grey Border (Page Area) SHOULD BE TRANSPARENT. This is no longer the case beginning approximately with LibreOffice Writer Version 5.0.0.0. Worked properly in earlier releases.
Comment 1 raal 2016-03-30 09:48:44 UTC
Please could you attach test file? Thanks
Comment 2 Eugene Markow 2016-03-30 10:26:46 UTC
A sample test output file has been attached when I initially posted this bug. Please see:

"Created attachment 123920 [details]
Sample exported PNG image file (1200 W x 600 H) from Writer"

I'll attach the original .odt file from which the exported file was created if that's what you are asking for.
Comment 3 Eugene Markow 2016-03-30 10:54:57 UTC
Created attachment 123954 [details]
Sampt ODT File from which exported image originated
Comment 4 Eugene Markow 2016-03-30 11:02:37 UTC
Note: In the attached ODT file in the current dev version of LibreOffice Writer (5.1.2.1) and in previous "working" versions prior to LibreOffice Writer 5.0.0.0, I have the following setting:

* Format -> Page -> Transparency -> No Transparency

This setting, in versions of LiberOffice Writer prior to 5.0.0.0, worked fine and resulted in a transparency outside of the grey borders of the imported image.

It no longer works and there is no transparency in the exported image. I have tried using the "Transparency -> Transparency 100%" setting and this still does not work.
Comment 5 V Stuart Foote 2016-03-30 13:39:55 UTC
As Armin indicates in bug 96922 c#15, I don't believe bitmap export to PNG with alpha channel transparency has ever been implemented for Writer.

Bitmap export from Writer to JPEG and PNG was implemented as a feature for the 4.1 release, prior to that export was only to HTML or PDF. Addition of transparency to frames in Writer was implemented at 4.2 and refined at 4.3.

Frames of individual images, draw objects, paragraphs, and even the page canvas correctly retain their transparency as set for the frame--distinct from Area from 4.2 onward. But the Writer bitmap export has never supported a PNG alpha channel for the page, unlike the Draw export to PNG with alpha channel provides.

I suppose it might be a reasonable enhancement. I see a use case for preparing alpha channel PNG using Writers better text and paragraph manipulation as more efficient than text boxes in Draw.

Beleive we can resolve this invalid, or morph it to an enhancement. 

@Armin?
Comment 6 Armin Le Grand (allotropia) 2016-04-01 08:24:43 UTC
Agreed, enhancement would be good.
Also please take a 2nd look at using 'Selection' in the dialog. It should limit export to the selected parts. In Writer and formal functionality that will probably create new writer pages (temporaily), add the selected stuff and export. It might re-layout (only one paragraph selected...?) which might need to be discussed.
It will not use transparency due to Writer always painting the Page as BG. This is also discussable, even when Writer stuff is selected (text, ...).
In that context it would also be handy to discuss if 'convert to Graphic...' like in Draw/Impress in the context menu of slections would be nice - it comes in handy sometimes and of course is even more useful when keeping the transparency.
Just some thoughts...
Comment 7 Xisco Faulí 2018-06-04 16:41:10 UTC Comment hidden (obsolete)
Comment 8 V Stuart Foote 2020-09-25 14:43:48 UTC
*** Bug 115508 has been marked as a duplicate of this bug. ***
Comment 9 m_a_riosv 2024-06-18 00:52:24 UTC Comment hidden (obsolete)
Comment 10 Stéphane Guillou (stragu) 2024-06-18 02:14:20 UTC
I reproduce comment 0: testing with attachment 123954 [details] ODT, File > Export > PNG ("save transparency" ticked), the result is a solid background.
Same if setting page background to:
A. none fill + no transparency
B. none fill + full transparency
C. none fill + partial (80%) transparency
D. solid fill + full transparency
E. solid fill + partial (80%) transparency

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6f4adc1274cfac30b9097411bb193bd4386969f0
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3

Indeed, this is inconsistent with Draw's PNG export.
Same happens with Calc for case A. However, Calc's page style does not support transparency, so I'm unsure if anything should be done there. Better keep this Writer-specific.

Regarding the claim that case A is a 5.0 regression: I checked with the linux-64-releases bibisect repository and found that libreoffice-5.0.3.2 was the first version affected. In LO 5.0.3.1, it would result in what Eugene expects.
No bibisect repo to check more precisely, but `git log libreoffice-5.0.3.1..libreoffice-5.0.3.2` shows the obvious cause:

commit a093c5cac3a7b5ecdddf10720f4543ddf82b9163
Author: Tomaž Vajngerl
Date:   Mon Oct 19 14:04:21 2015 +0200

    Writer image export: cmd. line, default to white background
    
    This commit fixes the writer image export (jpeg, png) that didn't
    work because the export pixel size was set to 0 by default. Now
    the default is set to document size (which depends on system DPI).
    
    When exporting to a PNG the background was transparent, which may
    not  be desired. The background color is now by default white and
    can be changed for DocumentToGraphicRenderer, but the dialog or
    command line don't support such an option - for now.

    Reviewed-on: https://gerrit.libreoffice.org/19479

It could be debated if case A should result in a transparent background (even though that's what happens in Draw), but to me, this is obviously a bug for the cases that do use a non-0 transparency value for the page background (an issue that predates Quikee's commit).

Quikee, what's you opinion on the issue now?
Comment 11 Mike Kaganski 2024-07-13 19:19:34 UTC
(In reply to Stéphane Guillou (stragu) from comment #10)
>     The background color is now by default white and
>     can be changed for DocumentToGraphicRenderer, but the dialog or
>     command line don't support such an option - for now.

This is obviously the issue here: the dialog needs a control to choose the background color - either a simple checkbox [ ]transparent, or a full-scale color selector.