Changeset - 29a2710ff229
[Not reviewed]
default
0 2 0
Dennis Fink - 3 years ago 2022-01-30 23:46:19
dennis.fink@c3l.lu
Shellcheck scripts
2 files changed with 11 insertions and 11 deletions:
0 comments (0 inline, 0 general)
convert.sh
Show inline comments
 
#!/bin/bash
 

	
 
for i in $(find $1/SVG -type f -not -name "Laurel_Wreath.svg" -not -iname "QRCode.svg"); do
 
    new_pdf_filename=$(echo $i | sed 's/svg/pdf/g' | sed 's/SVG/PDF/g')
 
    new_plain_svg_filename=$(echo $i | sed 's/SVG/PLAIN_SVG/g')
 
    new_png_filename=$(echo $i | sed 's/svg/png/g' | sed 's/SVG/PNG/g')
 
    new_eps_filename=$(echo $i | sed 's/svg/eps/g' | sed 's/SVG/EPS/g')
 
for i in $(find "$1/SVG" -type f -not -name "Laurel_Wreath.svg" -not -iname "QRCode.svg"); do
 
    new_pdf_filename=$(echo "$i" | sed 's/svg/pdf/g' | sed 's/SVG/PDF/g')
 
    new_plain_svg_filename=$(echo "$i" | sed 's/SVG/PLAIN_SVG/g')
 
    new_png_filename=$(echo "$i" | sed 's/svg/png/g' | sed 's/SVG/PNG/g')
 
    new_eps_filename=$(echo "$i" | sed 's/svg/eps/g' | sed 's/SVG/EPS/g')
 
    
 
    if [[ "$1" =~ "entr0py" ]]; then
 
        mkdir -p $(dirname ${new_png_filename})
 
        mkdir -p "$(dirname "${new_png_filename}")"
 
        if [[ "$1" =~ "Logo" ]]; then
 
            inkscape --export-type=png --export-filename="$new_png_filename" --export-area-page --export-width=1400 --export-height=1400 "$i"
 
        else
 
            inkscape --export-type=png --export-filename="$new_png_filename" --export-area-page --export-width=1920 --export-height=1080 "$i"
 
        fi
 
    elif [[ "$1" =~ "Videos" ]]; then
 
        mkdir -p $(dirname ${new_png_filename})
 
        mkdir -p "$(dirname "${new_png_filename}")"
 
        inkscape --export-type=png --export-filename="$new_png_filename" --export-area-page --export-width=1920 --export-height=1080 "$i"
 
    elif [[ "$1" =~ "Waysigns" ]]; then
 
        mkdir -p $(dirname ${new_png_filename}) $(dirname ${new_pdf_filename})
 
        mkdir -p "$(dirname "${new_png_filename}")" "$(dirname "${new_pdf_filename}")"
 
        inkscape --export-type=pdf --export-filename="$new_pdf_filename" --export-area-page --export-dpi=1200 --export-text-to-path --export-pdf-version=1.5 "$i"
 
        inkscape --export-type=png --export-filename="$new_png_filename" --export-area-page --export-dpi=1200 "$i"
 
    elif [[ "$1" =~ "Wallpapers" ]]; then
 
        mkdir -p $(dirname ${new_png_filename})
 
        mkdir -p "$(dirname "${new_png_filename}")"
 

	
 
        extension="${new_png_filename##*.}"
 
        filename="${new_png_filename%.*}"
 
@@ -30,7 +30,7 @@ for i in $(find $1/SVG -type f -not -nam
 
        inkscape --export-type=png --export-filename="${filename}_3200.${extension}" --export-area-page --export-width=3200 "$i"
 
        inkscape --export-type=png --export-filename="${filename}_3840.${extension}" --export-area-page --export-width=3840 "$i"
 
    else
 
        mkdir -p $(dirname ${new_pdf_filename}) $(dirname ${new_plain_svg_filename}) $(dirname ${new_png_filename}) $(dirname ${new_eps_filename})
 
        mkdir -p "$(dirname "${new_pdf_filename}")" "$(dirname "${new_plain_svg_filename}")" "$(dirname "${new_png_filename}")" "$(dirname "${new_eps_filename}")"
 
        inkscape --export-type=pdf --export-filename="$new_pdf_filename" --export-area-page --export-dpi=1200 --export-text-to-path --export-pdf-version=1.5 "$i"
 
        inkscape --export-type=png --export-filename="$new_png_filename" --export-area-page --export-dpi=1200 "$i"
 
        inkscape --export-type=eps --export-filename="$new_eps_filename" --export-area-page --export-dpi=1200 "$i"
optipng.sh
Show inline comments
 
#!/bin/bash
 

	
 
find ./$1 -type f -name "*.png" -print0 | xargs -0 -n1 -P$(($(lscpu -p | grep -v "#" | wc -l) * 2)) optipng -quiet -o7
 
find ./"$1" -type f -name "*.png" -print0 | xargs -0 -n1 -P$(($(lscpu -p | grep -vc "#") * 2)) optipng -quiet -o7
0 comments (0 inline, 0 general)