From f3d7b1ffe87d20bdd668ffbc68cbe58ae7bf1413 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 13 Nov 2023 11:37:33 +0000 Subject: [PATCH] [UI] Minor improvements to create_deluge_pngs Change the default compression tool to oxipng since it produces smaller files faster than zopfli. Add the ECT tool as an option to get maximum compression but is quite slow to complete. --- deluge/scripts/create_deluge_pngs | 34 ++++++++++++------ .../images/access/slider/slider-thumb.png | Bin 504 -> 500 bytes 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/deluge/scripts/create_deluge_pngs b/deluge/scripts/create_deluge_pngs index 6ed636db7..419f2d0cc 100755 --- a/deluge/scripts/create_deluge_pngs +++ b/deluge/scripts/create_deluge_pngs @@ -1,11 +1,26 @@ #!/bin/bash - -# A script to convert the Deluge svg icons to png. +# Convert Deluge svg icons to png. +# +# Requires +# * rsvg-convert +# * convert (ImageMagik) +# * oxipng +# +# Optional +# * ect (Efficient-Compression-Tool) +# +# Potential to combine pngquant with oxipng for further gains. +# +# Excellent compression with ECT but is much slower. For Linux need +# to build this tool from source. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" data_dir="$DIR/../ui/data" -zopfli_iter="--iterations=100" -zopflipng_bin="zopflipng --filters=01234mepb --lossy_8bit --lossy_transparent -y" + +OXI_COMPRESS="oxipng --opt 4 --interlace 0 --strip safe" +ECT_COMPRESS="ect --allfilters-b --pal_sort=120 -30060" + +COMPRESS=$OXI_COMPRESS # Create deluge png icon pack for all sizes. for size in 16 22 24 32 36 48 64 72 96 128 192 256 512; do @@ -13,11 +28,7 @@ for size in 16 22 24 32 36 48 64 72 96 128 192 256 512; do in_svg=$data_dir/pixmaps/deluge.svg out_png=$data_dir/icons/hicolor/${size}x${size}/apps/deluge.png rsvg-convert -w ${size} -h ${size} -o $out_png $in_svg - if [ "$size" -gt 128 ]; then - zopfli_iter="" - fi - echo $zopflipng_bin $zopfli_iter - eval $zopflipng_bin $zopfli_iter $out_png $out_png + eval $COMPRESS $out_png done # Create deluge-panel png for systray. @@ -44,7 +55,7 @@ cp $data_dir/icons/hicolor/48x48/apps/deluge.png $data_dir/pixmaps/deluge.png for file in $data_dir/pixmaps/*.svg; do out_png=${file%.*}16.png rsvg-convert -w 16 -h 16 -o $out_png $file - eval $zopflipng_bin $out_png $out_png + eval $COMPRESS $out_png done # Copy 16px deluge and status pngs to webui icons folder. @@ -58,11 +69,12 @@ for size in 32 192 512; do in_png=$data_dir/icons/hicolor/${size}x${size}/apps/deluge.png out_png=$data_dir/../web/icons/deluge-${size}.png cp $in_png $out_png +done # Create apple and android touch icons with background colour. apple_icon=$data_dir/../web/icons/deluge-apple-180.png rsvg-convert -w 180 -h 180 -b '#599EEE' -o $apple_icon $data_dir/pixmaps/deluge.svg -eval $zopflipng_bin $apple_icon $apple_icon +eval $COMPRESS $apple_icon # Create favicon.ico icon from pngs. for size in 16 32 48; do diff --git a/deluge/ui/web/themes/images/access/slider/slider-thumb.png b/deluge/ui/web/themes/images/access/slider/slider-thumb.png index bca9793123e1ee5fa01061d8f8521cc843f8dbd3..99e0e14e17cce68faa2c857a7553485618d06e05 100644 GIT binary patch delta 271 zcmV+q0r39#1M~xs?tk$~L_t(|+RfBAa>PIkL{W^qkCn+QQbgzOe*m6Bmk@!LM{yDK zOflMCzkJ2$*BnUO_*$WBt2LrId6#w0lf&So5|2sp*t zjPD5`y>2awZ_iH2BO*hRfs!O6B}o=iC+0B}sC+drBTKx%rg*1ar=* VDojgDDgXcg00>D%PDHLkV1oXIfPnx2 delta 275 zcmV+u0qp+t1NZ}w?tk@3L_t(|+RfCpdBk84gkdpJZe|y7MEw`wDy{=()~!Sd!22E>1Vskc6(`GJ|GR8K;AJqnEK8zkJ&Y-=g4>^ z<(dsDm--=-k~6HfX+2$4B%-~cHI(?u%;Y%O`gh?sb>nt7-hUNYR2JUhC_5PPoXF1D z9`o6bm{#rF)5&dLN<{-@Rg!?JBoS3fLh7m{0sT$VSxbr7pejj3b&{AeCtn;6f58o; zNgRbi;Cmiw0GEaL&rZnzNR_0bAW2O@k|vcT0aZzwR8C1ub&{HbBr#o{l0K5lQ}PdG ZHGs9DCS?w9whRCO002ovPDHLkV1i|hfk*%V