The png form is a lossless compression format. The compression force should be the maximum compression (9) by default.
Agree – I also wonder why it is not on (as it seems to be the standard in other apps, usually)
If not explained differently, let's put to New as Enhancement.
Perhaps could we think about simplying the dialog window : remove the compression force setting for png format and make it hard coded with the maximum force ?
As a follow up of comment 3 I filed bug #147550.
I think there is only one character to change near this line : https://git.libreoffice.org/core/+/HEAD/svx/source/dialog/compressgraphicdialog.cxx#52 It seems we just have to change initialization of memParam.CompressionMF to 9. struct memParam { bool ReduceResolutionCB = false; int MFNewWidth = 1; int MFNewHeight = 1; bool LosslessRB = true; bool JpegCompRB = false; < int CompressionMF = 6; > int CompressionMF = 9; int QualityMF = 80; int InterpolationCombo = 3; };
Jérôme: I tested your patch but on Draw, when trying to export in PNG, this code isn't called. I gave a try, after some research the patch would be: diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 73b1acbe871d..6d02a96b984b 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -4570,7 +4570,7 @@ </info> </maxInclusive> </constraints> - <value>6</value> + <value>9</value> </prop> <prop oor:name="Interlaced" oor:type="xs:int" oor:nillable="false"> <!-- UIHints: File Export Filetype PNG-Portable Network Perhaps we should also modify the Jérôme's code location (which must be used somewhere) + https://opengrok.libreoffice.org/xref/core/svtools/source/filter/exportdialog.cxx?r=d3849255#791 791 case FORMAT_PNG : 792 { 793 // Compression 1..9 794 mxPNGCompression->show(); 795 sal_Int32 nCompression = mpFilterOptionsItem->ReadInt32("Compression", 6); 796 if ( ( nCompression < 1 ) || ( nCompression > 9 ) ) 797 nCompression = 6; replace both "6" values by "9" the goal would be to have a homogenous thing, not a "9" value by default in a case, and a "6" value in other cases. Now I don't know if it's the right value to put I just can tell that Gimp uses "9" by default. Since it's the number 1 in open source world for raster images, I would trust their judgment. However seeing some comments in https://bugs.documentfoundation.org/show_bug.cgi?id=147550, it seems some may disagree. Heiko/Xisco: any thoughts here?
I just found where's the code quoted by Jérôme is used. - Open Writer - insert an image - right click on the image - choose "Compress..." I confirm its suggestion allows to change the default value for PNG compression to 9 here.
The struct memParam is just for holding user input during a session. The default needs to be set at both places, the struct and in the common.xcs file. No opinion from my side what the best value is.