resize big images and compress them #120
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I resized the backgrounds that were bigger than 2000px wide with imagemagick (exact command is
convert -thumbnail '2000>' $image $image
, there was a bit of trial and error until I found that this gives decent results) and then reduce their size with pngcrush (pngcrush -ow -brute $image $image.tmp
). A few images were bigger after this process, so I just git reset'd them.On top of that, I added a github workflow that checks the size of the image and add an annotation if the size is bigger than 1 MB (this is a bit arbitrary). I don't intend for it to be blocking, just to help us pause and think when we are about to push a 15 MB image.
I wanted the action to annotate the files with a warning. Unfortunately, I don't think it's possible to annotate a file (it's only possible to annotate a line in a file) so the warning does not show up in the PR. Instead I make the workflow fail and the author will then receive a notification and can check out the warnings.
rationale:
The "background" image is displayed as ~1000px wide. I doubled it to account for some high DPI screens. We could be smarter and provide several resolutions and format but I don't think the engine handles that anyway (and we would need some automation to do it properly). So this is already an improvement.
I did not check every single image but for the one I looked at I could not find any big difference.