Bug 459415

Summary: Krita exports weirdly huge pngs when colorspace conversion is involved
Product: [Applications] krita Reporter: Yu-Hsuan Lai <raincolee>
Component: File formatsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: halla
Priority: NOR    
Version: 5.1.1   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: All   
Latest Commit: Version Fixed In:

Description Yu-Hsuan Lai 2022-09-19 22:54:33 UTC
SUMMARY
The pngs exported from Krita are really huge when the .kra is in a colorspace and .png is converted to sRGB during export.


STEPS TO REPRODUCE
1. Open test.kra in Krita
2. File -> Export -> Save as Type: png
3. Export with default options

OBSERVED RESULT
The exported png is 2.39MB

EXPECTED RESULT
The exported png is much smaller than that. I opened the exported file in Windows' built-in Photos, save a copy of it, and it's only 767KB.
If I converted the .kra in Krita and then exported it, it's about 400KB only.

SOFTWARE/OS VERSIONS
Krita Version: 5.1.1
Qt Version (compiled): 5.12.12


ADDITIONAL INFORMATION
test.kra is attached
Comment 1 Yu-Hsuan Lai 2022-09-19 22:55:56 UTC
test.kra is too large to be uploaded as an attachment. please download it here: https://drive.google.com/file/d/1g3wUlCMUCokH0O2qvt-y_YnB9WOmvyvJ/view?usp=sharing
Comment 2 Halla Rempt 2022-09-20 07:36:28 UTC
Yes, well, Photos doesn't support 16 bit/channel PNG, which krita does support. Converting to sRGB does not drop the channel depth to 8 bit/channel.
Comment 3 Yu-Hsuan Lai 2022-09-20 10:42:56 UTC
(In reply to Halla Rempt from comment #2)
> Yes, well, Photos doesn't support 16 bit/channel PNG, which krita does
> support. Converting to sRGB does not drop the channel depth to 8 bit/channel.

Is there an option to drop it to 8bit at export?
Comment 4 Halla Rempt 2022-09-20 10:47:33 UTC
No... You'll have to manually convert the channel depth for that.
Comment 5 Halla Rempt 2022-09-20 12:57:59 UTC
Git commit 59425a042fc3208e3e5d6101796affb7d4656d69 by Halla Rempt.
Committed on 20/09/2022 at 12:57.
Pushed by rempt into branch 'master'.

Add an option to convert to 8 bit/channel when exporting to PNG

M  +5    -4    libs/ui/kis_png_converter.cpp
M  +2    -1    libs/ui/kis_png_converter.h
M  +6    -2    plugins/impex/png/kis_png_export.cc
M  +86   -79   plugins/impex/png/kis_wdg_options_png.ui

https://invent.kde.org/graphics/krita/commit/59425a042fc3208e3e5d6101796affb7d4656d69
Comment 6 Halla Rempt 2022-09-20 12:58:16 UTC
Git commit 0db7c21cae65789370386f58c762dbc96e492d06 by Halla Rempt.
Committed on 20/09/2022 at 12:58.
Pushed by rempt into branch 'krita/5.1'.

Add an option to convert to 8 bit/channel when exporting to PNG
(cherry picked from commit 59425a042fc3208e3e5d6101796affb7d4656d69)

M  +5    -4    libs/ui/kis_png_converter.cpp
M  +2    -1    libs/ui/kis_png_converter.h
M  +6    -2    plugins/impex/png/kis_png_export.cc
M  +86   -79   plugins/impex/png/kis_wdg_options_png.ui

https://invent.kde.org/graphics/krita/commit/0db7c21cae65789370386f58c762dbc96e492d06