Commit 0a164a5
chasinglightning
·
2025-04-10 22:04:14 -0400 EDT
parent 17dde9e
add some scripts
2 files changed,
+78,
-0
| ... | ... | @@ -0,0 +1,4 @@ | |
| 1 | + | until gotify-desktop; do | |
| 2 | + | echo "'gotify' crashed with exit code $?. Respawning.." >&2 | |
| 3 | + | sleep 1 | |
| 4 | + | done |
+74,
-0
| ... | ... | @@ -0,0 +1,74 @@ | |
| 1 | + | #!/bin/bash | |
| 2 | + | # | |
| 3 | + | # quick script to make variants for animated retrospring icons or headers and direct upload to replace a user's existing ones. good for when a user wants to use a specific gif but carrierwave processing glitches it somehow | |
| 4 | + | # | |
| 5 | + | # deps: charmbracelet/gum, imagemagick | |
| 6 | + | ||
| 7 | + | filename=$(gum input --placeholder "without an extension") | |
| 8 | + | ||
| 9 | + | echo -e "header or icon \n" | |
| 10 | + | ||
| 11 | + | CHOOSE=$(gum choose --limit 1 "header" "icon") | |
| 12 | + | ||
| 13 | + | echo -e "you chose ${CHOOSE} \n" | |
| 14 | + | ||
| 15 | + | echo -e "making dirs \n" | |
| 16 | + | ||
| 17 | + | if [ "${CHOOSE}" == "header" ]; then | |
| 18 | + | mkdir web mobile retina original | |
| 19 | + | elif [ "${CHOOSE}" == "icon" ]; then | |
| 20 | + | mkdir large medium small original | |
| 21 | + | else | |
| 22 | + | echo -e "mkdir failed for some reason" | |
| 23 | + | fi | |
| 24 | + | ||
| 25 | + | echo -e "dirs made \n" | |
| 26 | + | ||
| 27 | + | echo -e "copying original from workdir to dedicated folder \n" | |
| 28 | + | ||
| 29 | + | cp ./$filename.gif ./original/$filename.gif | |
| 30 | + | ||
| 31 | + | echo -e "move done \n" | |
| 32 | + | ||
| 33 | + | ORIGW=$(identify -format '%w' ./original/$filename.gif[0]) | |
| 34 | + | ORIGH=$(identify -format '%h' ./original/$filename.gif[0]) | |
| 35 | + | ||
| 36 | + | echo -e "making mobile version \n" | |
| 37 | + | ||
| 38 | + | if [ "${CHOOSE}" == "header" ]; then | |
| 39 | + | magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 450x105^ /tmp/tmp-header-mobile.gif && magick /tmp/tmp-header-mobile.gif -gravity center -crop 450x105+0+0 +repage ./mobile/$filename.gif | |
| 40 | + | ||
| 41 | + | echo -e "mobile done \n" | |
| 42 | + | ||
| 43 | + | echo -e "making retina version \n" | |
| 44 | + | ||
| 45 | + | magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 900x210^ /tmp/tmp-header-retina.gif && magick /tmp/tmp-header-retina.gif -gravity center -crop 900x210+0+0 +repage ./retina/$filename.gif | |
| 46 | + | ||
| 47 | + | echo -e "retina done \n" | |
| 48 | + | ||
| 49 | + | echo -e "making web version \n" | |
| 50 | + | ||
| 51 | + | magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 1500x350^ /tmp/tmp-header-web.gif && magick /tmp/tmp-header-web.gif -gravity center -crop 1500x350+0+0 +repage ./web/$filename.gif | |
| 52 | + | ||
| 53 | + | echo -e "web done \n" | |
| 54 | + | elif [ "${CHOOSE}" == "icon" ]; then | |
| 55 | + | magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 80x80^ /tmp/tmp-icon-small.gif && magick /tmp/tmp-icon-small.gif -gravity center -crop 80x80+0+0 +repage ./small/$filename.gif | |
| 56 | + | ||
| 57 | + | echo -e "small done \n" | |
| 58 | + | ||
| 59 | + | echo -e "making medium version \n" | |
| 60 | + | ||
| 61 | + | magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 256x256^ /tmp/tmp-icon-medium.gif && magick /tmp/tmp-icon-medium.gif -gravity center -crop 256x256+0+0 +repage ./medium/$filename.gif | |
| 62 | + | ||
| 63 | + | echo -e "medium done \n" | |
| 64 | + | ||
| 65 | + | echo -e "making large version \n" | |
| 66 | + | ||
| 67 | + | magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 500x500^ /tmp/tmp-icon-large.gif && magick /tmp/tmp-icon-large.gif -gravity center -crop 500x500+0+0 +repage ./large/$filename.gif | |
| 68 | + | ||
| 69 | + | echo -e "large done \n" | |
| 70 | + | else | |
| 71 | + | echo -e "img creation failed for some reason idk" | |
| 72 | + | fi | |
| 73 | + | ||
| 74 | + | echo -e "script done" |