diff --git a/frontend/cypress/fixtures/test-image-png.png b/frontend/cypress/fixtures/test-image-png.png index 4145569396..86c42a5606 100644 Binary files a/frontend/cypress/fixtures/test-image-png.png and b/frontend/cypress/fixtures/test-image-png.png differ diff --git a/frontend/resources/images/deco-left.png b/frontend/resources/images/deco-left.png index bd14661c7a..5ccb9aa7a6 100644 Binary files a/frontend/resources/images/deco-left.png and b/frontend/resources/images/deco-left.png differ diff --git a/frontend/resources/images/deco-right.png b/frontend/resources/images/deco-right.png index cc108924e5..f89dc14907 100644 Binary files a/frontend/resources/images/deco-right.png and b/frontend/resources/images/deco-right.png differ diff --git a/frontend/resources/images/email/logo-github.png b/frontend/resources/images/email/logo-github.png index 9c65f71a4a..e3d3215af3 100644 Binary files a/frontend/resources/images/email/logo-github.png and b/frontend/resources/images/email/logo-github.png differ diff --git a/frontend/resources/images/email/logo-instagram.png b/frontend/resources/images/email/logo-instagram.png index c0ba9bb7d8..3b94e53a29 100644 Binary files a/frontend/resources/images/email/logo-instagram.png and b/frontend/resources/images/email/logo-instagram.png differ diff --git a/frontend/resources/images/email/logo-taiga.png b/frontend/resources/images/email/logo-taiga.png index 6e29f6bcea..e604e8b15a 100644 Binary files a/frontend/resources/images/email/logo-taiga.png and b/frontend/resources/images/email/logo-taiga.png differ diff --git a/frontend/resources/images/email/logo-twitter.png b/frontend/resources/images/email/logo-twitter.png index dd73069bfc..4860be5d82 100644 Binary files a/frontend/resources/images/email/logo-twitter.png and b/frontend/resources/images/email/logo-twitter.png differ diff --git a/frontend/resources/images/email/logo-uxbox.png b/frontend/resources/images/email/logo-uxbox.png index 0bde659689..8b3a078296 100644 Binary files a/frontend/resources/images/email/logo-uxbox.png and b/frontend/resources/images/email/logo-uxbox.png differ diff --git a/frontend/resources/images/email/uxbox-title.png b/frontend/resources/images/email/uxbox-title.png index 45869e7581..18a878202c 100644 Binary files a/frontend/resources/images/email/uxbox-title.png and b/frontend/resources/images/email/uxbox-title.png differ diff --git a/frontend/resources/images/favicon.png b/frontend/resources/images/favicon.png index c185a572e3..1645d8b36a 100644 Binary files a/frontend/resources/images/favicon.png and b/frontend/resources/images/favicon.png differ diff --git a/frontend/resources/images/form/adobe-xd.png b/frontend/resources/images/form/adobe-xd.png index f2946ae396..40c0c5fce1 100644 Binary files a/frontend/resources/images/form/adobe-xd.png and b/frontend/resources/images/form/adobe-xd.png differ diff --git a/frontend/resources/images/form/figma.png b/frontend/resources/images/form/figma.png index 5e3bccb1a7..01511465da 100644 Binary files a/frontend/resources/images/form/figma.png and b/frontend/resources/images/form/figma.png differ diff --git a/frontend/resources/images/form/invision.png b/frontend/resources/images/form/invision.png index 551b8e2c52..c57f8993fe 100644 Binary files a/frontend/resources/images/form/invision.png and b/frontend/resources/images/form/invision.png differ diff --git a/frontend/resources/images/form/never-used.png b/frontend/resources/images/form/never-used.png index cda0947ecf..1018899951 100644 Binary files a/frontend/resources/images/form/never-used.png and b/frontend/resources/images/form/never-used.png differ diff --git a/frontend/resources/images/form/sketch.png b/frontend/resources/images/form/sketch.png index b923c607c8..d917d08b4e 100644 Binary files a/frontend/resources/images/form/sketch.png and b/frontend/resources/images/form/sketch.png differ diff --git a/frontend/resources/images/form/uxpin.png b/frontend/resources/images/form/uxpin.png index 02b5d93314..bbd155d6a4 100644 Binary files a/frontend/resources/images/form/uxpin.png and b/frontend/resources/images/form/uxpin.png differ diff --git a/frontend/scripts/compress-png b/frontend/scripts/compress-png new file mode 100755 index 0000000000..b18a64b96a --- /dev/null +++ b/frontend/scripts/compress-png @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +# This script automates compressing PNG images using the lossless Zopfli +# Compression Algorithm. The process is slow but can produce significantly +# better compression and, thus, smaller file sizes. +# +# This script is meant to be run manually, for example, before making a new +# release. +# +# Requirements +# +# zopflipng - https://github.com/google/zopfli +# Debian/Ubuntu: sudo apt install zopfli +# Fedora: sudo dnf install zopfli +# macOS: brew install zopfli +# +# Usage +# +# This script takes a single positional argument which is the path where to +# search for PNG files. By default, the target path is the current working +# directory. Run from the root of the repository to compress all PNG images. Run +# from the `frontend` subdirectory to compress all PNG images within that +# directory. Alternatively, run from any directory and pass an explicit path to +# `compress-png` to limit the script to that path/directory. + +set -o errexit +set -o nounset +set -o pipefail + +readonly TARGET="${1:-.}" +readonly ABS_TARGET="$(command -v realpath &>/dev/null && realpath "$TARGET")" + +function png_total_size() { + find "$TARGET" -type f -iname '*.png' -exec du -ch {} + | tail -1 +} + +echo "Compressing PNGs in ${ABS_TARGET:-$TARGET}" + +echo "Before" +png_total_size + +readonly opts=( + # More iterations means slower, potentially better compression. + #--iterations=500 + -m + # Try all filter strategies (slow). + #--filters=01234mepb + # According to docs, remove colors behind alpha channel 0. No visual + # difference, removes hidden information. + --lossy_transparent + # Avoid information loss that could affect how images are rendered, see + # https://github.com/penpot/penpot/issues/1533#issuecomment-1030005203 + # https://github.com/google/zopfli/issues/113 + --keepchunks=cHRM,gAMA,pHYs,iCCP,sRGB,oFFs,sTER + # Since we have git behind our back, overwrite PNG files in-place (only + # when result is smaller). + -y +) +time find "$TARGET" -type f -iname '*.png' -exec zopflipng "${opts[@]}" {} {} \; + +echo "After" +png_total_size