lmms icon indicating copy to clipboard operation
lmms copied to clipboard

Optimize PNG images using ImageOptim

Open jahunt1 opened this issue 1 year ago • 7 comments

This PR reduces the file size of PNGs in the following directories: /data/backgrounds/ /data/themes/classic/ /data/themes/default/

I used the ImageOptim app to compress the PNG file size in a lossless way.

By compressing the PNG images my hope is that additional system resources will be freed to do other awesome things with LMMS.

Update: I meant to include these ImageOptim screenshots when creating the PR: Savings for /data/themes/classic Savings for /data/themes/default

jahunt1 avatar Jul 18 '24 04:07 jahunt1

@tresf is this something we should be doing?

Rossmaxx avatar Jul 18 '24 05:07 Rossmaxx

@tresf is this something we should be doing?

Ideally, yes. Most of what ImageOptim removes is metadata, which we're fine with. It also uses various other optimization methods to reduce size without any loss of pixel data. It should probably be the standard for PNG resources moving forward.

https://imageoptim.com/

I took a cursory look at the PR and I didn't see anything wrong with it. Images look identical as before with the advantage of slightly smaller file size. I'm curious how much this adds up to overall in our desktop installers.

With regards to freeing system resources claims, this is likely untrue for LMMS due to how pixmap data is loaded into memory in Qt, but if there's no downside, I would say it's worth merging.

tresf avatar Jul 18 '24 06:07 tresf

How does ImageOptim compare to other lossless PNG compressors? Last time I looked into it ZopfliPNG was the best tool I could find, but that was a while ago so maybe there are newer and better options.

Spekular avatar Jul 18 '24 13:07 Spekular

How does ImageOptim compare to other lossless PNG compressors? Last time I looked into it ZopfliPNG was the best tool I could find, but that was a while ago so maybe there are newer and better options.

I'm not sure about the latest and greatest PNG compression technology. ImageOptim is what I had used in the past so that's what I went with. Thanks for pointing out that there may be better options.

jahunt1 avatar Jul 18 '24 13:07 jahunt1

With regards to freeing system resources claims, this is likely untrue for LMMS due to how pixmap data is loaded into memory in Qt, but if there's no downside, I would say it's worth merging.

I am brand new to Qt and LMMS development. Thank you for sharing knowledge about how pixmaps work.

There should be no downside to this change as the compression is supposed to be lossless.

jahunt1 avatar Jul 18 '24 13:07 jahunt1

I meant to include these ImageOptim screenshots when creating the PR

Right, so we'll shrink the packages about 0.25 - 0.5 MB. This is not very significant savings (our installers average 40MB - 100MB depending on the platform/compression), but I do not see any downsides.

tresf avatar Jul 18 '24 16:07 tresf

Do we have a way to ensure this is done to any future artwork? It would be a shame if this work were omitted from future themes, or even reverted when modifying existing themes.

DomClark avatar Jul 21 '24 22:07 DomClark

Do we have a way to ensure this is done to any future artwork?

Due to efforts to migrate assets to SVG (#7767 relevant) I'm not sure this should be a concern moving forward.

rubiefawn avatar Mar 13 '25 19:03 rubiefawn

I looked through about 350 of the images (stuff that isn't a white icon on a transparent background) and I see no tomfoolery here. Approving

I've never dealt with a git conflict with a png before, so I checked the commit log for data/themes and didn't see any commits that this would revert. The closet was a change to the faders that came in a few months prior. Merging.

tresf avatar Mar 13 '25 20:03 tresf