Skip to content

Instantly share code, notes, and snippets.

@alifeee
Last active November 8, 2024 23:45
Show Gist options
  • Save alifeee/fc33ea141cf1a5085498d81c460d0d59 to your computer and use it in GitHub Desktop.
Save alifeee/fc33ea141cf1a5085498d81c460d0d59 to your computer and use it in GitHub Desktop.
nautilus convert image script (place in `~/.local/share/nautilus/scripts/`)
#!/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
#!/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