Last active
November 8, 2024 23:45
-
-
Save alifeee/fc33ea141cf1a5085498d81c460d0d59 to your computer and use it in GitHub Desktop.
nautilus convert image script (place in `~/.local/share/nautilus/scripts/`)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# convert an image from something to something else | |
original_image="${1}" | |
echo "given file: ${original_image}" | |
if [ ! -f "${original_image}" ]; then | |
read -p "file does not exist, press ENTER to quit" ENTER | |
exit 1 | |
fi | |
filename="${original_image%.*}" | |
extension="${original_image##*.}" | |
echo "converting ${original_image} from ${extension} format" | |
read -p "to? (png/jpg/etc) " TO | |
new_image="${filename}.${TO}" | |
echo "run:" | |
echo "convert ${original_image} ${new_image}" | |
convert "${original_image}" "${new_image}" | |
echo "done !" | |
file "${new_image}" | |
read -p "press ENTER to quit" ENTER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# convert an image from something to something else | |
gnome-terminal -- bash -c 'bash ~/.local/share/nautilus/scripts/.convert\ image "'"${1}"'"; sleep 1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment