[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    Re: Help needed to greatly reduce size of SVN repo images.
From:       Martin Rys <spleefer90 () gmail ! com>
Date:       2024-04-15 22:31:54
Message-ID: CACbE=3o+SYtt6RVMPJRrunkHj6efSDn3OGjQXvQ1+992XmvqrQ () mail ! gmail ! com
[Download RAW message or body]

Huge thanks!

Should you have some more spare (CPU) time, --zopfli combined together
with --fast seems to be a good compromise, taking 5x as long instead
of 100x as much.
Looks like the savings are up to 6% over the current files with fast zopfli.

2s || 10s || 228s
regular || --zopfli --fast || --zopfli
oxipng --opt max --preserve visualdict-gui1.png  2.23s user 0.03s
system 810% cpu 0.280 total
oxipng --zopfli --fast --opt max --preserve visualdict-gui1.png
10.26s user 0.03s system 100% cpu 10.207 total
oxipng --zopfli --opt max --preserve visualdict-gui1.png  228.26s user
1.03s system 875% cpu 26.184 total

Side note, in trunk, there are two files named with .PNG instead of
the lowercase version.

Taking a peek at trunk, if you wanted to, you could do a similar run
against JPG/jpg/jpeg with jpegoptim:
Optimizing JPEG/JFIF /mnt/svn/trunk/promo/graphics/kdelogo/kdelogo_godzilla.jpg
 [jpegoptim] Reduced by 182.28 KB (-22.84%) from 798.14 KB

Which in comparison to oxipng should finish instantly.

And if you wanted to take an even deeper look, svgo can possibly save
some space too, but a bit deeper look at the results is necessary
there:
Optimizing SVG /mnt/svn/trunk/promo/graphics/kdelogo/k-logo-crystal.svg
 [svgo] Reduced by 206.63 KB (-94.11%) from 219.56 KB

Once again - thank you!
Looking forward to seeing the package size drop on the next round of
version releases :)

Martin


On Mon, Apr 15, 2024 at 11:10 PM Albert Astals Cid <aacid@kde.org> wrote:
>
> El dijous, 11 d'abril del 2024, a les 13:07:40 (CEST), Martin Rys va escriure:
> > Hey there,
> >
> > there are about 3700 PNGs in the SVN repo, totalling 200MB.
> > I aim to reduce that greatly, losslessly, without losing any data or
> > quality, while keeping the PNG format.
> >
> > 200MB may not seem like much, but such files exist there:
> >   * 2MB PNG that reduces to 1MB
> >   * 900KB PNG that reduces to 30KB
> >
> > Basically, the total savings are huge, kwin alone loses about 5MB in
> > total package size on Arch Linux after these optimizations - Arch
> > ships packages including documentation.
> >
> > To achieve this, I am in need of someone with a developer account that
> > can either just send in changed files, or someone who would run oxipng
> > for every PNG in the repo as per https://rys.rs/optimization if they
> > have the CPU power and time.
> >
> > At the time of writing, it is:
> >   oxipng --zopfli --opt max "${filepath}"
>
> I have run
>   find -name *.png | parallel oxipng  --opt max --preserve {} \;
> over trunk
>
> I have *not* included --zopfli because the time wasted on it is ridiculous,
> e.g. running it over
>    ./l10n-kf6/it/docs/khelpcenter/fundamentals/visualdict-gui1.png
> goes from 5 seconds to 675 seconds.
>
> Cheers,
>   Albert
>
> >
> > Maybe it would be good to also add:
> > --preserve
> >          Preserve file permissions and timestamps if possible
> >
> > This losslessly optimizes the PNG file, but it is *very* demanding on
> > CPU time, so it either needs a lot of threads(think threadripper), or
> > a lot of time, or both.
> >
> > This does not delete EXIF data (--strip would, not desired).
> > Wiping EXIF would save some % more, but that is a bit controversial -
> > we would need to decide what to keep (Author field and possibly more),
> > it is mildly dangerous, and can always be done later if desired.
> > The savings from getting rid of EXIF shouldn't be that interesting in
> > the end, unless something is wrong and there is excessive metadata
> > stored, I have not looked if that is the case yet.
> >
> > If nobody steps up in a few days, Tosky said they'd give it a try on
> > the Matrix channel.
> >
> > P.S. Yes, there are images in the translations repo! They are mostly
> > screenshots of UI for the given localization. They are used sparsely,
> > maybe an entirely different, automated system to create them would be
> > a good idea, maybe with a switch to SVG/JXL to save on size, but the
> > aim of this thread is to reduce size of the currently existing PNGs.
> >
> > Martin
>
>
>
>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic