Bug 75285 - "1-bit colormap" PNG images print as solid black boxes
Summary: "1-bit colormap" PNG images print as solid black boxes
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
4.1.5.3 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Image-Colorize
  Show dependency treegraph
 
Reported: 2014-02-20 22:40 UTC by Rik Shaw
Modified: 2021-08-03 15:16 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments
1-bit colormap image: looks fine but prints as "black box" (30.33 KB, application/vnd.oasis.opendocument.text)
2014-02-20 22:40 UTC, Rik Shaw
Details
Simple demo document from 5.1.6.2 (12.39 KB, application/vnd.oasis.opendocument.text)
2018-01-31 11:15 UTC, Janne Korkkula
Details
QR code sample image (534 bytes, image/png)
2018-02-28 23:51 UTC, Bill McGonigle
Details
'bad' b/w PNG (72.59 KB, image/png)
2018-03-08 12:09 UTC, bugzilla
Details
'good' b/w PNG (58.10 KB, image/png)
2018-03-08 12:13 UTC, bugzilla
Details
This is a screenshot what a pdf with this problem looks like in evince. (19.91 KB, image/png)
2018-03-26 19:36 UTC, ge.huber
Details
test doc with PNGs from rhynas (145.65 KB, application/vnd.oasis.opendocument.text)
2018-11-15 16:21 UTC, Thorsten Behrens (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rik Shaw 2014-02-20 22:40:28 UTC
Created attachment 94462 [details]
1-bit colormap image: looks fine but prints as "black box"

LibreOffice 4.1.5.3 Ubuntu 12.04 64 bit (will attempt to test on 4.2.x shortly).  Sorry I can't confirm what version the bug would have come in.

See attachment, and attempt to print it!  For me, the image shows fine in the document, and it shows fine in the "print preview".  However, when printed to paper, it is a solid black box with distortion on the top 10% of the black box (sort of gray garbled stuff).

The image itself (you can extract from the .odt) is a .png image that gives these properties doing "file filename.png" in a terminal:

PNG image data, 1029 x 479, 1-bit colormap, non-interlaced

If I EXPORT test-tomatoes.odt to .pdf, it will print fine.  Also, the image itself will print fine from an image viewer program.  It is only within LibreOffice (same image tried in LibreOffice Writer and LibreOffice Draw) that the image will print as this "black box".

Somehow, I am guessing LibreOffice is not able to handle such "1-bit images" but this is a valuable format for black and white printing!
Comment 1 Rik Shaw 2014-02-20 22:46:25 UTC
Sorry, the attachment thinks it is "plain text" but I can't attempt to specify .odt as the attachment type?  Any advice welcomed.  It should be a standard .odt file.
Comment 2 Rik Shaw 2014-02-20 22:55:34 UTC
I have placed it in google drive as well so you can download it from there until I sort out how to properly have it attached here:

https://drive.google.com/file/d/0B0WVXg1DL6ducEZqRGJCd2hmNHc
Comment 3 Rik Shaw 2014-02-21 17:50:49 UTC
Thanks for the help in redefining the document type to "odt" in the attachment.

I have heard from another colleage this issue does not appear for them, either with Linux or Windows LO.  I will need to do further testing, but possibly it is an issue with my printer driver (again, however, the "black box" only appears if I print from LibreOffice: printing from PDF viewer or image viewer print fine).  I will attempt to report back here if that is the case.
Comment 4 Joel Madero 2014-05-19 14:58:08 UTC
Ubuntu 14.04 x64
LibreOffice 4.2.4.2 release

I am unable to reproduce this. Marking this as WFM. If you are still able to reproduce with 4.2.4.2 release please mark the bug as UNCONFIRMED once again. 

Just a heads up - I printed to file instead of print to printer (should be no difference).
Comment 5 Janne Korkkula 2018-01-31 11:12:43 UTC
Most definitely not resolved, I just hit this on Ubuntu 16.04.3 LTS with LibreOffice 5, 5.1.6.2 Build ID 1:5.1.6~rc2-0ubuntu1~xenial2. UI Renderer: default.

A simple 1-bit PNG prints on paper as an all-black square, whether it has a color map or not. "Printing to a file" exports a valid PDF which will print OK, but printing directly to a real printer fails.

(OpenGL is not in use and I can't test with it, since with OpenGL switched on LibreOffice won't start at all.)
Comment 6 Janne Korkkula 2018-01-31 11:15:07 UTC
Created attachment 139467 [details]
Simple demo document from 5.1.6.2
Comment 7 Buovjaga 2018-02-24 12:53:22 UTC
(In reply to Janne Korkkula from comment #6)
> Created attachment 139467 [details]
> Simple demo document from 5.1.6.2

I reproduce.

Arch Linux 64-bit
Version: 6.1.0.0.alpha0+
Build ID: 40c33132cfa6582dfccf17e787f10dd4dbd0819d
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on February 24th 2018
Comment 8 Buovjaga 2018-02-24 12:54:16 UTC
Note for testers: feel free to resize the image to be much smaller. No need to waste toner.
Comment 9 Bill McGonigle 2018-02-28 23:51:52 UTC
Created attachment 140233 [details]
QR code sample image

I'm seeing this in Writer on QR codes, which is a very common image to include these days.  Attaching a sample made thusly:

  qrencode -t png -l H 'https://bugs.documentfoundation.org/show_bug.cgi?id=75285' -m 0 -s 4 -o bug75285.png

libreoffice-5.4.5.1-1.fc27.x86_64
Comment 10 Thorsten Behrens (allotropia) 2018-03-05 13:40:27 UTC
* printing shows the bug
* export to PDF, and print to file shows the bug
* export to XHTML does not show the bug
Comment 11 Buovjaga 2018-03-05 13:43:28 UTC
(In reply to Thorsten Behrens (CIB) from comment #10)
> * export to PDF, and print to file shows the bug

Not for me.
Comment 12 bugzilla 2018-03-08 12:09:07 UTC
Created attachment 140469 [details]
'bad' b/w PNG
Comment 13 bugzilla 2018-03-08 12:11:36 UTC
I've just discovered this problem as well with b/w PNG graphics used in my Writer document (under Linux Mint 18.3, and LibreOffice v6.0.2.1.

(Note: LibreOffice OpenGL is off, and 'Convert Colours to Greyscale' is unticked.)


My Observations are:
 * Printing to laser or inkjet printers exhibits the same problem.
 * Out of 12 black/white PNG graphics, only 2 print OK but I can't see any difference between them and they were all edited in Gimp using the same process.
 
 * Changing mode to greyscale (but no change to content), all print OK.
 * Exporting the Writer page first to PDF then printing the PDF, all images print OK.
 * Printing the graphic directly from Gimp editor prints OK.
 * Printing exactly the same document from Writer on a Win7 PC prints OK.
 
I've attached a sample 'bad' b/w PNG (indexed 1-bit palette) and a rare 'good' b/w PNG in case it helps. My workaround at the moment is to change the mode of each graphic to greyscale after graphic editing is completed.

A solution would be much appreciated.
Comment 14 bugzilla 2018-03-08 12:13:19 UTC
Created attachment 140470 [details]
'good' b/w PNG
Comment 15 ge.huber 2018-03-26 18:34:10 UTC
Same problem here. Also I have the same problem with printing to PDF. Evince shows just a black rectangle.
Comment 16 ge.huber 2018-03-26 19:36:54 UTC
Created attachment 140890 [details]
This is a screenshot what a pdf with this problem looks like in evince.

Enclosed is a screenshot of what a pdf looks like. I also tried xpdf as the viewer but with the same results.
Comment 17 tadanet3 2018-03-28 12:07:41 UTC
It reproduced.
On Version: 5.4.5.1
Build ID: 1:5.4.5-0ubuntu0.17.10.5
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Local: ja-JP (ja_JP.UTF-8); Calc: group
Comment 18 ge.huber 2018-04-12 09:30:11 UTC Comment hidden (no-value)
Comment 19 Buovjaga 2018-04-12 09:52:55 UTC Comment hidden (no-value)
Comment 20 ge.huber 2018-05-03 14:17:55 UTC Comment hidden (no-value)
Comment 21 Buovjaga 2018-05-03 14:27:10 UTC
(In reply to ge.huber from comment #20)
> (In reply to Buovjaga from comment #19)
> > 
> > If you are not a paying customer, you just have to wait.
> 
> Is there a way to pay for a speedup for a fix of this specific bug?
> This is a serious question of course.

I will leave that to Vasily and Thorsten to answer (and maybe contact you privately).
Comment 22 Xisco Faulí 2018-08-02 09:01:09 UTC
Dear Vasily Melenchuk (CIB),
This bug has been in ASSIGNED status for more than 3 months without any
activity. Resetting it to NEW.
Please assigned it back to yourself if you're still working on this.
Comment 23 Armin Le Grand 2018-11-15 13:10:11 UTC
Have tried to reproduce on current master and on lo52, but could not get the error. Had someone recently checked this...?
Comment 24 Thorsten Behrens (allotropia) 2018-11-15 16:21:25 UTC
Created attachment 146670 [details]
test doc with PNGs from rhynas

No repro with current master - attaching test doc with last two PNGs from rhynas
Comment 25 Buovjaga 2018-11-15 16:27:34 UTC
(In reply to Janne Korkkula from comment #6)
> Created attachment 139467 [details]
> Simple demo document from 5.1.6.2

Still printing as black square.
My printer: Canon LBP7018C

Arch Linux 64-bit
Version: 6.2.0.0.alpha1+
Build ID: 72e6269b88a32a672e00d2c25f0d0400038d1360
CPU threads: 8; OS: Linux 4.19; UI render: default; VCL: gtk3_kde5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 14 November 2018
Comment 26 stavrosss 2019-09-02 07:25:21 UTC
Issue exists as described 

Windows 8.1 pro x64

Libreoffice 6.3
and Libreoffice 6.1.6.3


In the older version Loffice 5.4.3
the bug does not appear.

If anyone knows a version 6.xx that is ok let us know in the comments.
Comment 27 Thorsten Behrens (allotropia) 2020-02-18 22:00:14 UTC
So after much testing (Linux & Windows), I now believe this is NOTOURBUG.

While in 2018, on an opensuse Leap, I was able to repro, by now (using versions as old as 5.2.7), I don't see it anymore (neither print to PDF, nor export as PDF, nor print to CUPS-connected printer and intercepting the spool file shows the prob).

Versions:
* opensuse Tumbleweed - 20200108
* cups-filters-1.25.0-2.2.x86_64
* libcups2-2.3b6-1.3.x86_64
* libcupsimage2-2.3b6-1.3.x86_64
* cups-2.3b6-1.3.x86_64

This was very likely some bits in the CUPS filter chain meddling with the image - LibreOffice is passing down:

4 0 obj
<</Type/XObject/Subtype/Image/Width 1230/Height 1230/BitsPerComponent 1/Length 5 0 R
/Filter/CCITTFaxDecode/DecodeParms<</K -1/BlackIs1 true/Columns 1230>>
/ColorSpace/DeviceGray
/Mask 6 0 R

Whereas earlier CUPS output then converted that into:

8 0 obj
<</Subtype/Image
/ColorSpace/DeviceRGB
/Width 1230
/Height 1230
/BitsPerComponent 8
/Filter/DCTDecode/Length 42130>>
Comment 28 Buovjaga 2020-02-19 15:43:18 UTC
(In reply to Janne Korkkula from comment #6)
> Created attachment 139467 [details]
> Simple demo document from 5.1.6.2

Well, Thorsten, I am still able to repro with this document while printing to physical printer. Also, you talk about CUPS, but people on Windows could also repro.

After printing, I opened the file /var/spool/cups/d00211-001 in Okular and it did not show a black box, but the QR code.

Arch Linux
cups-filters 1.27.1
libcups 2.3.1
cups 2.3.1

Version: 7.0.0.0.alpha0+
Build ID: 9b8180dfb71e139d78be487967f741e1f9f46d51
CPU threads: 8; OS: Linux 5.5; UI render: default; VCL: kf5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 7 February 2020
Comment 29 Thorsten Behrens (allotropia) 2020-02-19 22:38:43 UTC
(In reply to Buovjaga from comment #28)
> Well, Thorsten, I am still able to repro with this document while printing
> to physical printer. Also, you talk about CUPS, but people on Windows could
> also repro.
> 
Ok, fair enough - then its NEEDINFO for the Windows side, perhaps stavrosss can share some more details of his setup (printer model, does it also happen when printing to file for that printer, or perhaps using this XPS foo).

> After printing, I opened the file /var/spool/cups/d00211-001 in Okular and
> it did not show a black box, but the QR code.
> 
Well the spool file then gets processed by CUPS before hitting the physical printer, so we'd need to get the final representation of that file. Could you try and extract that via this howto: https://wiki.ubuntu.com/DebuggingPrintingProblems#Getting_the_data_which_would_go_to_the_printer ?

(for completeness sake - with your description, for Linux, it is still NOTOURBUG)
Comment 30 Buovjaga 2020-02-20 15:09:11 UTC
(In reply to Thorsten Behrens (CIB) from comment #29)
> Well the spool file then gets processed by CUPS before hitting the physical
> printer, so we'd need to get the final representation of that file. Could
> you try and extract that via this howto:
> https://wiki.ubuntu.com/
> DebuggingPrintingProblems#Getting_the_data_which_would_go_to_the_printer ?
> 
> (for completeness sake - with your description, for Linux, it is still
> NOTOURBUG)

Yeah, I get it. I tried the steps, but /tmp/printout was not created. Maybe it is because the use of "FileDevice yes" was restricted in later CUPS versions.

Let's wait for Windows results.
Comment 31 QA Administrators 2020-08-19 03:46:16 UTC Comment hidden (obsolete)
Comment 32 QA Administrators 2020-09-19 04:14:03 UTC Comment hidden (obsolete)
Comment 33 Pierre François 2021-08-03 15:08:12 UTC
I face the same bug trying to print some QR code generated by the qrencode utility as PNG 1-bit colormap: it displays correctly on the screen and can be correctly exported as PDF, but when I print from LO writer to the printer, I get a black rectangle.

My version of LibreOffice is 7.0.2.2 and I run Ubuntu 20.04.2 LTS on a 64-bits OS.

I would be happy to help changing the status of this bug to unresolved.
Comment 34 Buovjaga 2021-08-03 15:16:20 UTC
(In reply to Pierre François from comment #33)
> I face the same bug trying to print some QR code generated by the qrencode
> utility as PNG 1-bit colormap: it displays correctly on the screen and can
> be correctly exported as PDF, but when I print from LO writer to the
> printer, I get a black rectangle.
> 
> My version of LibreOffice is 7.0.2.2 and I run Ubuntu 20.04.2 LTS on a
> 64-bits OS.
> 
> I would be happy to help changing the status of this bug to unresolved.

Please see comment 27