#!/bin/bash curdir=$PWD # Square ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNGT=`echo "$mf" | sed 's/\.svg/\_square_T.png/'` newPNG=`echo "$mf" | sed 's/\.svg/\_square.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_square.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_square.webp/'` convert $mf -resize 128x128! \ \( +clone -alpha extract \ -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \ \( +clone -flip \) -compose Multiply -composite \ \( +clone -flop \) -compose Multiply -composite \ \) -alpha off -compose CopyOpacity -composite \ $newPNGT convert $newPNGT -background white -flatten $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNGT -o $newWEBP done # square 48 ############################################################### for mf in $(find $PWD -name '*_square_T.png') do echo "processing $mf" newPNGT48=`echo "$mf" | sed 's/\_square_T.png/\_square_48_T.png/'` newPNG48=`echo "$mf" | sed 's/\_square_T.png/\_square_48.png/'` newJPG48=`echo "$mf" | sed 's/\_square_T.png/\_square_48.jpg/'` newWEBP48=`echo "$mf" | sed 's/\_square_T.png/\_square_48.webp/'` convert $mf -resize 48x48! $newPNGT48 convert $newPNGT48 -background white -flatten $newPNG48 convert -quality 95 $newPNG48 $newJPG48 cwebp -q 90 $newPNGT48 -o $newWEB48 done # square with shadow ############################################################### for mf in $(find $PWD -name '*_square_T.png') do echo "processing $mf" newPNGT=`echo "$mf" | sed 's/\_square_T.png/\_square_shadow_T.png/'` newPNG=`echo "$mf" | sed 's/\_square_T.png/\_square_shadow.png/'` newJPG=`echo "$mf" | sed 's/\_square_T.png/\_square_shadow.jpg/'` newWEBP=`echo "$mf" | sed 's/\_square_T.png/\_square_shadow.webp/'` convert -page +4+4 $mf -alpha set \ \( +clone -background black -shadow 60x4+4+4 \) +swap \ -background none -mosaic \ $newPNGT convert $newPNGT -background white -flatten $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNGT -o $newWEBP done # 3D ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNGT=`echo "$mf" | sed 's/\.svg/\_3D_T.png/'` newPNG=`echo "$mf" | sed 's/\.svg/\_3D.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_3D.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_3D.webp/'` convert $mf -resize 128x -fill gray50 -colorize 100% \ -raise 8 -normalize -blur 0x8 bubble_overlay.png convert $mf -resize 128x bubble_overlay.png \ -compose hardlight -composite \ $newPNGT convert $newPNGT -background white -flatten $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNGT -o $newWEBP done rm -f bubble_overlay.png # button rectangle ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNGT=`echo "$mf" | sed 's/\.svg/\_button_T.png/'` newPNG=`echo "$mf" | sed 's/\.svg/\_button.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_button.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_button.webp/'` convert $mf -resize 256 -alpha Set /backup/0_important_scripts/masks/rect_mask.png \ \( -clone 0,1 -alpha Opaque -compose Hardlight -composite \) \ -delete 0 -compose In -composite \ $newPNGT convert $newPNGT -background white -flatten $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNGT -o $newWEBP done # black outline ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNGT=`echo "$mf" | sed 's/\.svg/\_outlined_T.png/'` newPNG=`echo "$mf" | sed 's/\.svg/\_outlined.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_outlined.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_outlined.webp/'` convert $mf -resize 126x96 -alpha set -bordercolor none -border 3 \ /backup/0_important_scripts/masks/rounded_corner_mask.png -compose DstIn -composite \ /backup/0_important_scripts/masks/rounded_corner_overlay.png -compose Over -composite -trim +repage \ $newPNGT convert $newPNGT -background white -flatten $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNGT -o $newWEBP done # soft edge ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNGT=`echo "$mf" | sed 's/\.svg/\_vignette_T.png/'` newPNG=`echo "$mf" | sed 's/\.svg/\_vignette.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_vignette.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_vignette.webp/'` convert $mf -resize 128x -alpha set -virtual-pixel transparent \ -channel A -blur 0x8 -level 50%,100% +channel \ $newPNGT convert $newPNGT -background white -flatten $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNGT -o $newWEBP done # 32x icon size ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNG=`echo "$mf" | sed 's/\.svg/\_icon.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_icon.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_icon.webp/'` convert $mf -resize 32x -alpha off -background white -flatten -compose CopyOpacity \ $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNG -o $newWEBP done # 40x icon with border ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNG=`echo "$mf" | sed 's/\.svg/\_40.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_40.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_40.webp/'` convert $mf -resize 42x -alpha off -background white -flatten -compose CopyOpacity \ tmp_png.png convert tmp_png.png \ \( +clone -fx A +matte -blur 0x2 -shade 0x90 -normalize \ -blur 0x2 -negate -evaluate multiply .4 -negate -roll -.5-1 \ +clone -compose Multiply -composite \) \ -matte -compose In -composite $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNG -o $newWEBP done rm -f tmp_png.png # waving flag on pole ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNGT=`echo "$mf" | sed 's/\.svg/\_flag_waving_T.png/'` newPNG=`echo "$mf" | sed 's/\.svg/\_flag_waving.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_flag_waving.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_flag_waving.webp/'` convert $mf -resize 256x -alpha set -background none -wave 18x256 wave_trans.png convert /backup/0_important_scripts/masks/pole.png wave_trans.png -compose Multiply -gravity East -composite \ $newPNGT convert $newPNGT -background white -flatten $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNGT -o $newWEBP done rm -f wave_trans.png # darken border ############################################################### for mf in $(find $PWD -name '*.svg') do echo "processing $mf" newPNGT=`echo "$mf" | sed 's/\.svg/\_icon_64_T.png/'` newPNG=`echo "$mf" | sed 's/\.svg/\_icon_64.png/'` newJPG=`echo "$mf" | sed 's/\.svg/\_icon_64.jpg/'` newWEBP=`echo "$mf" | sed 's/\.svg/\_icon_64.webp/'` convert $mf -resize 64x \ /backup/0_important_scripts/masks/64_outline.png -composite \ $newPNGT convert $newPNGT -background white -flatten $newPNG convert -quality 95 $newPNG $newJPG cwebp -q 90 $newPNGT -o $newWEBP done echo "Done." play /usr/share/sounds/opcomp.wav