Replacement for nautilus-image-converter

Hello,

d oes anyone know a good replacement tool for nautilus-image-converter? (nautilus-image-converter - Fedora Packages)

I use it quite frequently and with the upcoming upgrade of my machine from F36 to F37 it will go away. Sad, but that’s what it is…

Thanks.

4 Likes

Since it uses ImageMagick under the hood, you can still use it from the command line if the GUI is not required.

3 Likes

You can search on the Internet or create your own Nautilus scripts and extensions:

Here I’ve coded a simple script:

sudo dnf install bash ImageMagick zenity

mkdir -p ~/.local/share/nautilus/scripts
tee ~/.local/share/nautilus/scripts/image-converter.sh << "EOF" > /dev/null
#!/usr/bin/bash

# Coded by: Vladislav Grigoryev <vg[dot]aetera[at]gmail[dot]com>
# License: GNU General Public License (GPL) version 3+
# Description: Resize images with ImageMagick from Nautilus
# Requires: bash coreutils ImageMagick nautilus zenity

script_init() {
	IFS="|" read -r IMG_SIZE IMG_WSIZE IMG_HSIZE IMG_OUT < <(zenity \
		--forms \
		--title="Image converter" \
		--text="$(wc -l \
			<<< "${IMG_PATH}") files selected" \
		--ok-label="Resize" \
		--add-combo="Size" \
		--combo-values="$(tr " " "|" \
			<<< "${IMG_SIZE[@]}")" \
		--add-entry="Width" \
		--add-entry="Height" \
		--add-list="Output" \
		--list-values="copy / default|replace")
}

script_exec() {
	if [ -n "${IMG_WSIZE}" ] || [ -n "${IMG_HSIZE}" ]
	then IMG_SIZE="${IMG_WSIZE}x${IMG_HSIZE}"
	fi
	if [ -z "${IMG_SIZE/ /}" ]
	then IMG_SIZE="${IMG_DSIZE}x${IMG_DSIZE}"
	fi
	while read -r IMG_PATH
	do
		IMG_OPATH="${IMG_PATH%/*}/resized.${IMG_PATH##*/}"
		convert "${IMG_PATH}" -resize "${IMG_SIZE}" "${IMG_OPATH}"
		if [ "${IMG_OUT}" = "replace" ]
		then mv -f "${IMG_OPATH}" "${IMG_PATH}"
		fi
	done <<< "${IMG_PATH}" | zenity \
		--progress \
		--pulsate \
		--auto-close \
		--no-cancel \
		--title="Image converter" \
		--text="Processing files..."
}

IMG_PATH="${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS/%$'\n'/}"
IMG_DSIZE="1024"
IMG_SIZE=(
	640x480 800x600 1024x768 1280x720 1366x768
	1440x900 1600x1200 1920x1080 2560x1440 3840x2160
)

if script_init
then script_exec
fi

exit 0
EOF
chmod +x ~/.local/share/nautilus/scripts/image-converter.sh

See also:

6 Likes

Is nautilus-image-converter really gone forever? It was such an easy way to quickly resize an image.

2 Likes

Thank you!

1 Like

The package in Fedora is orphaned and the original upstream project is dead. However, a maintained fork exists: Corey Berla / nautilus-image-converter · GitLab
So there is no reason someone couldn’t pick up that fork and package it for Fedora again.

1 Like

Thanks @heffer. I’m a retired dev on a completely different platform, but maybe I’ll learn how to package RPMs.

Any new infos on this? It is now over a year.

If you’re looking for a simple image converter then Switcheroo might be a handy alternative, it’s available as a flatpak and it works well.

1 Like

Wanted to recommend that.

But also curious about Nautilus extensions/scripts.

1 Like

Added f37, f40, image-editing, workstation

Added nautilus

Thanks to the initial work by @vgaetera, I’ve made some improvements to the script, allowing it to reduce image size by percentage in addition to previously added resizing to a fixed size or using custom dimensions.

Here is the code:

#!/usr/bin/bash

# Coded by: Vladislav Grigoryev <vg[dot]aetera[at]gmail[dot]com> and Omid Khalili <omid[dot]1985[at]gmail[dot]com>
# License: GNU General Public License (GPL) version 3+
# Description: Resize images by percentage or size using ImageMagick from Nautilus
# Requires: bash coreutils ImageMagick nautilus zenity

IMG_PATH="${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS/%$'\n'/}"
IMG_DSIZE="1024"
IMG_PERCENTAGES=(10% 20% 30% 40% 50% 60% 70% 80% 90%)
IMG_SIZES=(
    640x480 800x600 1024x768 1280x720 1366x768
    1440x900 1600x1200 1920x1080 2560x1440 3840x2160
)

script_init() {
    MODE=$(zenity --list \
        --title="Select Resize Mode" \
        --text="Resize mode for $(wc -l <<< "${IMG_PATH}") file(s):" \
        --radiolist \
        --column="Pick" --column="Mode" \
        TRUE "Percentage" FALSE "Size")

    if [ -z "$MODE" ]; then
        return 1  # Cancelled
    fi

    if [ "$MODE" = "Percentage" ]; then
        FORM_OUTPUT=$(zenity --forms \
            --title="Resize by Percentage" \
            --text="Choose a percentage:" \
            --ok-label="Resize" \
            --add-combo="Percentage" \
            --combo-values="$(IFS="|"; echo "${IMG_PERCENTAGES[*]}")" \
            --add-list="Output" \
            --list-values="copy / default|replace") || return 1
        IFS="|" read -r IMG_SIZE IMG_OUT <<< "$FORM_OUTPUT"
        RESIZE_MODE="percentage"
    elif [ "$MODE" = "Size" ]; then
        FORM_OUTPUT=$(zenity --forms \
            --title="Resize by Size" \
            --text="Choose fixed size or custom dimensions:" \
            --ok-label="Resize" \
            --add-combo="Size" \
            --combo-values="$(IFS="|"; echo "${IMG_SIZES[*]}")" \
            --add-entry="Width" \
            --add-entry="Height" \
            --add-list="Output" \
            --list-values="copy / default|replace") || return 1
        IFS="|" read -r IMG_SIZE IMG_WSIZE IMG_HSIZE IMG_OUT <<< "$FORM_OUTPUT"
        if [ -n "$IMG_WSIZE" ] || [ -n "$IMG_HSIZE" ]; then
            IMG_SIZE="${IMG_WSIZE}x${IMG_HSIZE}"
        fi
        if [ -z "${IMG_SIZE/ /}" ]; then
            IMG_SIZE="${IMG_DSIZE}x${IMG_DSIZE}"
        fi
        RESIZE_MODE="size"
    else
        return 1
    fi
}

script_exec() {
    while read -r IMG_PATH; do
        IMG_OPATH="${IMG_PATH%/*}/resized.${IMG_PATH##*/}"
        convert "${IMG_PATH}" -resize "${IMG_SIZE}" "${IMG_OPATH}"
        if [ "${IMG_OUT}" = "replace" ]; then
            mv -f "${IMG_OPATH}" "${IMG_PATH}"
        fi
    done <<< "${IMG_PATH}" | zenity \
        --progress \
        --pulsate \
        --auto-close \
        --no-cancel \
        --title="Image Resize" \
        --text="Processing files..."
}

if script_init; then
    script_exec
fi

exit 0

Or use this one command below to place it in the HOME/.local/share/nautilus/scripts folder:

git clone https://github.com/omid-1985/nautilus-resize-images.git && chmod +x nautilus-resize-images/install-resize-images.sh && sh nautilus-resize-images/install-resize-images.sh && rm -rf nautilus-resize-images/
1 Like