Bug 158250 - impress templates : a few png images could use indexed colours
Summary: impress templates : a few png images could use indexed colours
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.6.2.1 release
Hardware: All All
: medium normal
Assignee: Laurent Balland
URL:
Whiteboard: target:24.2.0 target:24.8.0 target:24...
Keywords:
Depends on:
Blocks: Win-Installer-Smaller Installer-Linux
  Show dependency treegraph
 
Reported: 2023-11-16 20:29 UTC by Jérôme
Modified: 2023-12-12 08:41 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
24 bits colours inside share/template/common/presnt/Candy.otp (1004.79 KB, image/png)
2023-11-16 20:35 UTC, Jérôme
Details
24 bits colours indexed on 8 bits inside share/template/common/presnt/Candy.otp (290.87 KB, image/png)
2023-11-16 20:36 UTC, Jérôme
Details
png files candidates inside ODF files in share/template (11.16 KB, text/plain)
2023-12-02 16:52 UTC, Jérôme
Details
2 images from Candy.otp which have been converted (302.85 KB, application/x-xz)
2023-12-03 16:37 UTC, Jérôme
Details
Vintage.otp proposition : one image converted in grey level (1.23 KB, application/x-xz)
2023-12-09 20:33 UTC, Jérôme
Details
Blueprint_Plans.otp pictures proposition : 1 into grey level, 2 into indexed colours (37.36 KB, application/x-xz)
2023-12-09 20:53 UTC, Jérôme
Details
Grey_Elegant.otp proposition : 6 images into grey levels (53.91 KB, application/x-xz)
2023-12-09 21:33 UTC, Jérôme
Details
Yellow Idea proposition : 5 images into grey levels (6.96 KB, application/x-xz)
2023-12-09 21:59 UTC, Jérôme
Details
Piano.otp proposition : 1 image in grey levels (1.50 KB, application/x-xz)
2023-12-10 08:24 UTC, Jérôme
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jérôme 2023-11-16 20:29:27 UTC
I extracted the content of the LibreOffice_7.6.2_Win_x86-64.msi archive (345MB) with msiextract.

A few presentations use large png images with 2^24 colours.

The png images could use 256 indexed colours (chosen among 2^24 different colours).
This would make those files smaller but the user doesn't see the difference.
Comment 1 Jérôme 2023-11-16 20:35:40 UTC
Created attachment 190881 [details]
24 bits colours inside share/template/common/presnt/Candy.otp
Comment 2 Jérôme 2023-11-16 20:36:36 UTC
Created attachment 190882 [details]
24 bits colours indexed on 8 bits inside share/template/common/presnt/Candy.otp
Comment 3 Stéphane Guillou (stragu) 2023-12-01 18:30:52 UTC
Thank you for the suggestion, Jérome.
Laurent, what do you think?
Comment 4 Laurent Balland 2023-12-02 10:06:25 UTC
I confirmed that some of the Indonesian set of templates contains large images.

@Jérôme: could you create a patch with this new picture? If you need assistance, I can help you (even in French ;-) ). But if you feel afraid of this task, I can take care of it.
Comment 5 Jérôme 2023-12-02 16:52:47 UTC
Created attachment 191194 [details]
png files candidates inside ODF files in share/template

result of the below command lines :
mkdir tmp && cd tmp
for f in $( find ../share/template -type f -size +400c -iname '*.otp' -o -iname '*.ott' -o -iname '*.ots' -o -iname '*.otg' ) ; do { rm -rf * && echo Into ${f}: && 7z x -bb0 -bd ${f} > /dev/null && find . -type f -size +300c -not -wholename './Thumbnails/thumbnail.png' -iname '*.png' -exec file {} \; | grep -iv colormap ; } ; done
Comment 6 Jérôme 2023-12-02 17:01:31 UTC
@Laurent
I'd be happy if you create a patch. Thank you very much.

Could we possibly catch this large image with a regression test ? Maybe just something like ODF template size > 1MB ?
Comment 7 Laurent Balland 2023-12-03 09:56:01 UTC
(In reply to Jérôme from comment #6)
> @Laurent
> I'd be happy if you create a patch. Thank you very much.
> 
> Could we possibly catch this large image with a regression test ? Maybe just
> something like ODF template size > 1MB ?

I will create the patch thanks to your png file. However, I know almost nothing about pictures format and indexed colors. So, it could be a good idea if you propose new version of oversized pictures.
Comment 8 Laurent Balland 2023-12-03 10:21:36 UTC
The patch is now expecting a review:
https://gerrit.libreoffice.org/c/core/+/160256
Comment 9 Jérôme 2023-12-03 14:05:51 UTC
I confirm this new file on gerrit is correct (from user point of view).
Comment 10 Jérôme 2023-12-03 16:37:18 UTC
Created attachment 191204 [details]
2 images from Candy.otp which have been converted

The larger image uses indexed colours.
The smaller image uses 255 grey levels + transparent kept.
Comment 11 Jérôme 2023-12-03 19:21:14 UTC
I just checked the other larger otp files.

I can't achieve size reduction without loss of quality on :
- Freshes.otp (1,4M)
- Growing_Liberty.otp (400K)
- Nature_Illustration.otp (87K)

I can achieve only a tiny size reduction on :
- Vintage.otp (2,5M)
- Blueprint_Plans.otp (587K)
- Grey_Elegant.otp (165K)
- Yellow_Idea.otp (68K)
Comment 12 Laurent Balland 2023-12-03 19:54:55 UTC
(In reply to Jérôme from comment #11)
> I just checked the other larger otp files.
> 
> I can't achieve size reduction without loss of quality on :
> - Freshes.otp (1,4M)
> - Growing_Liberty.otp (400K)
> - Nature_Illustration.otp (87K)
> 
> I can achieve only a tiny size reduction on :
> - Vintage.otp (2,5M)
> - Blueprint_Plans.otp (587K)
> - Grey_Elegant.otp (165K)
> - Yellow_Idea.otp (68K)

Thanks for the modified pictures of Candy template. Please drop here the other pictures. I will merge with previous commit.
Comment 13 Laurent Balland 2023-12-05 14:11:48 UTC
(In reply to Jérôme from comment #10)
> Created attachment 191204 [details]
> 2 images from Candy.otp which have been converted
> 
> The larger image uses indexed colours.
> The smaller image uses 255 grey levels + transparent kept.

I'm not sure that the smaller image is necessary, as it contains only text. But I will first integrate it, and see later how to improve the template.
Comment 14 Commit Notification 2023-12-07 15:48:47 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c805fac1715e4955708299334e95d0dff47e32d7

tdf#158250 Candy Impress template: replace picture

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Jérôme 2023-12-09 20:33:14 UTC
Created attachment 191332 [details]
Vintage.otp proposition : one image converted in grey level
Comment 16 Jérôme 2023-12-09 20:53:36 UTC
Created attachment 191333 [details]
Blueprint_Plans.otp pictures proposition : 1 into grey level, 2 into indexed colours
Comment 17 Jérôme 2023-12-09 21:33:20 UTC
Created attachment 191334 [details]
Grey_Elegant.otp proposition : 6 images into grey levels

Note that several images are in 2 versions in the OTP file : SVG and PNG.
Comment 18 Jérôme 2023-12-09 21:59:15 UTC
Created attachment 191335 [details]
Yellow Idea proposition : 5 images into grey levels
Comment 19 Jérôme 2023-12-10 08:24:33 UTC
Created attachment 191342 [details]
Piano.otp proposition : 1 image in grey levels
Comment 20 Jérôme 2023-12-10 10:20:01 UTC
I checked all the Impress templates. I haven't found any other savings without loss of quality.
Comment 21 Laurent Balland 2023-12-10 10:27:42 UTC
(In reply to Jérôme from comment #20)
> I checked all the Impress templates. I haven't found any other savings
> without loss of quality.

Thanks a lot Jérôme :-)
I will propose a new patch for all these new pictures.
Comment 22 Commit Notification 2023-12-10 16:18:37 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6fda99d874d73f93b51e483e29b85b69333acef9

tdf#158250 Vivid, Piano templates: replace pictures

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Commit Notification 2023-12-10 16:18:39 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b91d7649a6c2be19439b9c042ee9520c32e621e4

tdf#158250 Grey Elegant template: replace pictures

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 24 Commit Notification 2023-12-10 16:18:41 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9168109f39a587a14c65b5b22103c909d6a6054e

tdf#158250 Yellow Idea template: replace pictures

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 25 Commit Notification 2023-12-10 16:19:44 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7cfd3da36b54301fd51189282b39c71efd6bb894

tdf#158250 Blueprint Plans template: update images

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 26 Commit Notification 2023-12-12 08:40:04 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/0be761900d69febd9ccb2a6a88b6183416d09c7b

tdf#158250 Blueprint Plans template: update images

It will be available in 24.2.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 27 Commit Notification 2023-12-12 08:41:10 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/736a7b476f041e06af9ab3e5185d64ab8e912ec1

tdf#158250 Yellow Idea template: replace pictures

It will be available in 24.2.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 28 Commit Notification 2023-12-12 08:41:12 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/3f1b1400ca1341385f70a1f8edc3ea74ce9f1d85

tdf#158250 Grey Elegant template: replace pictures

It will be available in 24.2.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 29 Commit Notification 2023-12-12 08:41:14 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/1345eba186501f75d9bc814875d7946a36679796

tdf#158250 Vivid, Piano templates: replace pictures

It will be available in 24.2.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.