KolibriOS / kolibrios

The official mirror of the main KolibriOS repository
267 stars 32 forks source link

Optimize images #22

Closed ace-dent closed 6 months ago

ace-dent commented 8 months ago

Selected png images have been losslessly compressed with pngslim, reducing file sizes. Addresses https://github.com/KolibriOS/kolibrios/issues/5.

I am proceeding with caution and would value any extra testing and feedback. Thanks! :-)

ace-dent commented 8 months ago

1 commit: git-svn-id: svn://kolibrios.org@9988 a494cfbc-eb01-0410-851d-a64ba20cac60

ace-dent commented 8 months ago

@dunkaist - who can review these changes and ideally build an iso from the GitHub PR? I'd like a bit more oversight before committing to SVN ... 😅

dunkaist commented 7 months ago

@ace-dent, I wonder what could be the proper way to test changes like this. I tried gm compare but it did find the difference between the old and the new images. Maybe because you modify the color of transparent pixels, don't you? We definitely can't just run our tests and see if everything is ok. By the way, how do you test your tool?

ace-dent commented 7 months ago

@dunkaist - thanks. It is rare, but I do occasionally optimize fully transparent pixels - as is the case for the logo.

By the way, how do you test your tool?

In addition to basic file integrity with pngcheck, and manual checking by eye, I also use a bash script to generate a double sha256 based on visible pixels (a 'visual hash')- to ensure the displayed image remains unchanged. E.g.:

#!/bin/bash

# Requires ImageMagick

vis_rgb="$(magick "$1" -strip -background "#000000000000" -flatten PPM:- \
  | shasum --algorithm 256 --binary \
  | head -c 64)"

vis_alpha="$(magick "$1" -strip -alpha extract PPM:- \
  | shasum --algorithm 256 --binary \
  | head -c 64)"

echo "Visible Image SHA: ${vis_rgb}-${vis_alpha}"

In the context of KolibriOS...

dunkaist commented 7 months ago

@ace-dent, please, try this kolibri.raw image. It has mostly the same files as kolibri.iso. I can't rebuild programs that require MSVC, but your PR doesn't seem to touch them anyway.

Also, it would be great to mention in the commit message how to optimize an image if somebody needs to edit it later.

ace-dent commented 7 months ago

@dunkaist - thanks! That's great... although I have never encountered a raw image before... 🤔 😅 ... I typically use copy.sh to quickly test things.

Also, it would be great to mention in the commit message how to optimize an image if somebody needs to edit it later.

Is your suggestion to provide some guide on image optimization?

Update: Seems to be working great! Thanks!... but will test further before merging in SVN. I welcome any feedback.

dunkaist commented 7 months ago

@ace-dent, I don't think you have to write a long guide. Just a note or a link to info on how to get an optimized image from a regular one.

If you have fixed this issue, then it should be ok to commit.

ace-dent commented 7 months ago

@dunkaist - I can add a note on useful software. 🤓

Normally (with git) I like multiple, very granular commits- this add more info, avoids merge conflicts on larger projects, and makes undoing mistakes a little easier(!)... From memory, SVN has more overhead for commits...? Should I merge many of these commits into one for SVN?

dunkaist commented 7 months ago

@ace-dent, I prefer smaller commits too. That said, I'm 100% sure there are a few people in the project who are trying to 'save' revision numbers by putting everything they have into a single commit. So, my advice is to commit according to this PR, i.e. several small commits. However be prepared to hear that you wasted a lot of revision numbers :)

Maybe commit an image or two, wait a day or two for feedback, and then commit all the rest.

dunkaist commented 7 months ago

@ace-dent, by the way, jpegli

ace-dent commented 6 months ago

Hi @dunkaist! After a month of bit-crunching, 65 commits and 288 files later... I'm done! :-) Please could you compile another raw image, so that I can test before starting to integrate via SVN? Thanks!

dunkaist commented 6 months ago

@ace-dent, thank you for this great effort. Please, find the new kolibri.raw

ace-dent commented 6 months ago

@dunkaist - Some software is missing from the raw image ~ Games: BNC (Bulls & Cows), Dungeons, Kosilka, Life3, Nu_Pogodi. Media: Log_El. Other: CNC_Control, Planet_V.

Would it be possible to provide an image with those built, for testing?

dunkaist commented 6 months ago

@ace-dent, I compiled everything I could compile locally on my laptop. Building MSVC programs for KolibriOS isn't straightforward. Therefore, I believe you can just commit those changes and then download and check the kolibri.raw from our build server.

ace-dent commented 6 months ago

All changes have been committed via SVN. Closing this PR as complete. Many thanks to @dunkaist for valuable support!

SVN: 10013 git: 1ecb0687a0518dfe3b786dcc47ad140fe2b10120 SVN: 10014 git: e72feb405247098a29994982f3bffea3cfa16b47 SVN: 10018 git: 25335bf375a477a3336da45ee3395454d620d028 SVN: 10019 git: d2b2b581586a9ee06e838c60c4dfd330f27a362b SVN: 10020 git: b64f0094252c89500edcdcd143264a9b05ebe5e5 SVN: 10021 git: 4e2a675928f8d39bd79fc4d72b3ba3b57f89d207 SVN: 10022 git: 3dccbc50a0e0eff532b79766db0babdf690f5792 SVN: 10023 git: 176ea5ae89c873be7461de3991cf17a7b23fa3f7 SVN: 10024 git: 4febef90c35022d4712bf9b8d8dbea96f79cd58b SVN: 10025 git: 865fd3a82535d6cdc5d0d4332c39573c4cce6c75 SVN: 10026 git: a2db07d6e12eb083d9c2ce6244490736126ef6e9 SVN: 10027 git: 4cc0fb283bf2d37dfdcf81c9fb614b341fbb7b57 SVN: 10028 git: 857a5d17e23f4ffd1c46cabfff085b8e8423cd4e SVN: 10029 git: dc416dc668dc06acde47211949efa4cd4c37ccdb SVN: 10030 git: fcfa96f74d87ce9d81b77dfeb69eb1ca3c74db90 SVN: 10031 git: 33d9aafa30bc52e79055fd832db7ddc263345c7e SVN: 10032 git: fe541dca92fc52399e703f036e8f47512bbd3d8e SVN: 10033 git: 8735d3ceacaee2dc7043d027e5ca6357ac2dc451 SVN: 10034 git: 7ab6b3e9844ffeca8f94db220754e01fd1d334ca SVN: 10035 git: e61afd673e8021ab50ebca7488fd40cd6d4f0607 SVN: 10036 git: e9a34d071d86028b98201447ff104c0face691be SVN: 10037 git: d3208b5671f3d4339915f6076e47ed1567d29db2 SVN: 10038 git: c3dbc03cb9b927898abd93cb15a522c49d335731