Bug 127234 - I can't save result of QR-code generator to PNG with good quality
Summary: I can't save result of QR-code generator to PNG with good quality
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: notBibisectable, regression
Depends on:
Blocks: Graphics-Export
  Show dependency treegraph
 
Reported: 2019-08-30 07:09 UTC by Roman Kuznetsov
Modified: 2023-03-24 07:06 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Example odg with QR code (13.14 KB, application/vnd.oasis.opendocument.graphics)
2019-08-30 07:17 UTC, Roman Kuznetsov
Details
PNG result (224.44 KB, image/png)
2019-08-30 07:17 UTC, Roman Kuznetsov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Kuznetsov 2019-08-30 07:09:23 UTC
Description:
I can't save result of QR-code generator to PNG with good quality

Steps to Reproduce:
1. Open file from attach
2. Select QR code
3. Right click -> Save
4. Select PNG type file
5. Save
6. Look at result => very poor quality of PNG

Saving to SVG gives fine result

Actual Results:
very poor quality of PNG

Expected Results:
fine quality of PNG


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.4.0.0.alpha0+ (x86)
Build ID: a1a401acaafee0b1f154d368a247d74d61c62191
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2019-08-28_15:45:26
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded
Comment 1 Roman Kuznetsov 2019-08-30 07:17:07 UTC
Created attachment 153742 [details]
Example odg with QR code
Comment 2 Roman Kuznetsov 2019-08-30 07:17:31 UTC
Created attachment 153743 [details]
PNG result
Comment 3 Xisco Faulí 2019-10-03 12:02:03 UTC
Reproduced in

Version: 6.4.0.0.alpha0+
Build ID: c9336bfb6bbf6d73d3f23c124262ade30133448d
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: x11; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

but not in

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 4 Roman Kuznetsov 2019-10-11 20:01:20 UTC
(In reply to Xisco Faulí from comment #3)
> Reproduced in
> 
> Version: 6.4.0.0.alpha0+
> Build ID: c9336bfb6bbf6d73d3f23c124262ade30133448d
> CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: x11; 
> Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
> Calc: threaded
> 
> but not in
> 
> Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)

Xisco from where QR generator in 4.1?
Comment 5 Xisco Faulí 2019-10-16 14:16:57 UTC
No need to generate a QR code, use can use the file attached
Comment 6 Aron Budea 2019-11-16 22:18:52 UTC
Started in 4.2, but I can't start a lot of builds in that repo now, I get the following error message, and it quits:
javaldx: Could not find a Java Runtime Environment!
Warning: failed to read path from javaldx

All I can say, the exported PNG is already bad at this commit: 6c3a09b3b3ca9ad0c81a55efaaedad35c39de767
Comment 7 päde 2020-02-28 06:40:03 UTC
Example: www.qrcode-generator.ch 
/1.) Select text icon and enter text 
/2.) create qr code 
/3.) PNG and open with IrfanView 64-bit (downolad www.irfanview.com) 
/4.) Edit/copy 
/5.) insert in Libre-Office document
Comment 8 Buovjaga 2020-06-08 15:05:41 UTC
I am unable to open attachment 153742 [details] in the older commits of Linux 42max repo. However, going backwards from the commit mentioned by Áron, I can say that the bad result is already in source commit ed87e4c4b09d0f623c350528a4f6a6d049735bd1

I'm calling this notBibisectable.

(In reply to päde from comment #7)
> Example: www.qrcode-generator.ch 
> /1.) Select text icon and enter text 
> /2.) create qr code 
> /3.) PNG and open with IrfanView 64-bit (downolad www.irfanview.com) 
> /4.) Edit/copy 
> /5.) insert in Libre-Office document

This is not equivalent. With this, there is no problem in the latest commit of Linux 42max repo.
Comment 9 Telesto 2021-03-09 15:26:05 UTC
As landed at bug 51510 with pretty much the same issue (see duplicate & response Justin L)

*** This bug has been marked as a duplicate of bug 51510 ***
Comment 10 Roman Kuznetsov 2021-03-09 18:43:55 UTC
(In reply to Telesto from comment #9)
> As landed at bug 51510 with pretty much the same issue (see duplicate &
> response Justin L)
> 
> *** This bug has been marked as a duplicate of bug 51510 ***

I'm not sure. Where is a link between saving embedded SVG as PNG into DOC/DOCX and bad PNG quality after saving QR code (OLE object) as different PNG file?
Comment 11 Telesto 2021-03-09 18:54:22 UTC
(In reply to Roman Kuznetsov from comment #10)
> (In reply to Telesto from comment #9)
> > As landed at bug 51510 with pretty much the same issue (see duplicate &
> > response Justin L)
> > 
> > *** This bug has been marked as a duplicate of bug 51510 ***
> 
> I'm not sure. Where is a link between saving embedded SVG as PNG into
> DOC/DOCX and bad PNG quality after saving QR code (OLE object) as different
> PNG file?

Apparently QR is generated as SVG. SVG not supported by DOCX/DOC format and converted to PNG which goes wrong. I reported the same thing: see bug 135746.
Comment 12 Roman Kuznetsov 2021-03-09 18:57:32 UTC
(In reply to Telesto from comment #11)

> 
> Apparently QR is generated as SVG. SVG not supported by DOCX/DOC format and
> converted to PNG which goes wrong. I reported the same thing: see bug 135746.

Where in this bug report do you see anything about DOC/DOCX?
Comment 13 Telesto 2021-03-09 19:45:24 UTC
(In reply to Roman Kuznetsov from comment #12)
> (In reply to Telesto from comment #11)
> 
> > 
> > Apparently QR is generated as SVG. SVG not supported by DOCX/DOC format and
> > converted to PNG which goes wrong. I reported the same thing: see bug 135746.
> 
> Where in this bug report do you see anything about DOC/DOCX?

I don't, but all this stuff is tied together.. The DOCX filter utilizes the same conversion SVG to PNG as used for export. At least this would 'proper' coding style entail; re-use the same function instead of duplicate the code (copy/paste). With single place you can 'fix'. With the downside that it's broken all over the place. 

And this should be the case in my observations. There is something seriously broken in the file-format to file format conversion area (not only SVG -> PNG). Across all components (Writer/Draw/Impress/Calc). 

But well, if you prefer to leave this separate, also fine. But I prefer directing all relevant bugs to bug 51510, to give it more priority [old + plenty duplicates + big CC list). And I believe this one would be fixed with bug 51510. However that's my take; no warrantees.

I leave it up to you.. [and sorry for marking it as duplicate in rude manner]
Comment 14 Mike Kaganski 2021-03-22 13:30:38 UTC
The problem is antialiased pixel processor created in drawinglayer::convertToBitmapEx (drawinglayer/source/tools/converters.cxx). If anti-aliasing is disabled, the result will be sharp.

We possibly need to pass "do not use AA" to the function somehow when we save SVGs to PNG.
Comment 15 Mike Kaganski 2021-03-22 15:06:50 UTC
Additional (or maybe the main) problem is that the bitmap is generated in getVectorGraphicReplacement, where it has the dimensions defined in the SVG; and then this bitmap is scaled to the wanted dimensions in GraphicHelper::ExportGraphic. This is very sub-optimal for a vector image format like SVG.

Even ImpGraphic::getBitmapEx has the logic to get the replacement, and then scale it. Odd.
Comment 16 QA Administrators 2023-03-24 03:24:59 UTC Comment hidden (obsolete)
Comment 17 Roman Kuznetsov 2023-03-24 07:06:03 UTC
No repro in

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b5c3a7502f7ff6ccf0f829c1f3a2ba50b8584c41
CPU threads: 16; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: ru-RU
Calc: CL threaded

Very Nice!
Closed as WFM