Created
July 12, 2025 16:05
-
-
Save majabojarska/58130b5bc9d5b84c4c062c7660995b4e to your computer and use it in GitHub Desktop.
Nautilus image conversion plugin
This file contains hidden or 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
#!/usr/bin/env bash | |
# Requires imagemagick to be installed and PATH-accesible | |
# Place in ~/.local/share/nautilus/scripts | |
# Call `nautilus -q` and start a new nautilus instance to load. | |
EXT_OUTPUT=$( | |
zenity --list \ | |
--title="Convert image" \ | |
--print-column=1 \ | |
--column="Extension" \ | |
jpeg png webp | |
) | |
if [ -z "${EXT_OUTPUT}" ]; then | |
exit 0 | |
fi | |
while IFS= read -r PATH_INPUT; do | |
PATH_DIR_PARENT="$(dirname "${PATH_INPUT}")" | |
NAME_NO_EXT=$(basename "$PATH_INPUT" | cut -d. -f1) | |
PATH_OUTPUT="${PATH_DIR_PARENT}/${NAME_NO_EXT}.${EXT_OUTPUT}" | |
convert "${PATH_INPUT}" "${PATH_OUTPUT}" | |
done <<<"${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment