Hi, I am a Windows user that try to change to Linux, but some of the little things that I do at work, don’t work on Linux.
Like the subject, there is a way for install a script like Microsoft Powertoys for resize images only with one right click of the mouse?
Searching to Google, I see that exist Nautilus Image Converter Plugin, but seems is not maintened and I think it do not work in Bluefin, I should layer it with rpm-ostree if I have well understand.
I am a simple user, not a developer, this is the main reason for choose an atomic distro, no fear to destroy my system.
I installed it on my secondary laptop to try, but at the moment, I can’t replace all the workflow on Linux.
One of basical thing I do daily, is take a picture 1024p or different, resize 1:1 aspect ratio and resize to 800x800p. In Windows I can do in some seconds, Linux take me minutes…
Okay, I see. Maybe you can try Converseen. You can install it from the flatpak software repo. It can resize images in batch. Maybe that is something for you.
Generally, you shouldn’t layer things.
Use flatpaks for graphical programs, and brew for command line programs.
If this is something you do all the time, you can install imagemagick and use a little script to change the aspect ratio and resize:
magick input.jpg -gravity center -extent '%[fx:min(w,h)]x%[fx:min(w,h)]' -resize 800x800 output.jpg
So you can put this into a script, say, resize_square.sh:
#!/bin/bash
# Usage: ./resize_square.sh input.jpg output.jpg
set -euo pipefail
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <input_file> <output_file>" >&2
exit 1
fi
input="$1"
output="$2"
magick "$input" \
-gravity center \
-extent '%[fx:min(w,h)]x%[fx:min(w,h)]' \
-resize 800x800 \
"$output"
then you can
resize_square.sh input.jpg output.jpg
If you want a graphical application, open Software and search for xnview.
You will find XnViewMP to manipulate images, and XnConvert for manipulating images in batches.
Not user-friendly for a very simple thing.
In the microsoft powertoys so, i can select various sizes and modify for the size i need in the moment.
I appreciate the anwers, but seems i can’t have what i want.
I have installed also converseen, but open the program, take the image and convert it, is not fast.
I was inspired by the nautilus-imageconverter on github. This does what you want in the gnome file explorer (Nautilus) for converting the file format. Let’s see if we can make something for converting the image size.
It seems that both dependencies of nautilus-imageconverter are preinstalled on the Bluefin image: ImageMagick and Zenity. With these prerequisites, I asked Duck.ai to generate a script for resizing images.
#!/bin/bash
# Check if ImageMagick is installed
if ! command -v convert &> /dev/null; then
zenity --error --text="ImageMagick is not installed. Please install it to use this script."
exit 1
fi
# Get the selected image file
IMAGE_FILE="$1"
# Prompt the user for the new width and height
DIMENSIONS=$(zenity --entry --title="Resize Image" --text="Enter new dimensions (width x height):" --entry-text="800x600")
# Check if the user canceled the entry
if [ -z "$DIMENSIONS" ]; then
zenity --error --text="No dimensions entered. Exiting."
exit 1
fi
# Extract width and height from the input
WIDTH=$(echo $DIMENSIONS | cut -d'x' -f1)
HEIGHT=$(echo $DIMENSIONS | cut -d'x' -f2)
# Check if the width and height are valid numbers
if ! [[ "$WIDTH" =~ ^[0-9]+$ ]] || ! [[ "$HEIGHT" =~ ^[0-9]+$ ]]; then
zenity --error --text="Invalid dimensions entered. Please enter valid numbers."
exit 1
fi
# Define the output file name
OUTPUT_FILE="resized_$(basename "$IMAGE_FILE")"
# Resize the image using ImageMagick
convert "$IMAGE_FILE" -resize "${WIDTH}x${HEIGHT}" "$OUTPUT_FILE"
# Check if the conversion was successful
if [ $? -eq 0 ]; then
zenity --info --text="Image resized successfully!\nSaved as: $OUTPUT_FILE"
else
zenity --error --text="Failed to resize the image."
fi
Simply put the script content in ~/.local/share/nautilus/scripts/image-resize.sh and make sure the script is executable chmod +x ~/.local/share/nautilus/scripts/image-resize.sh.
If you now open the file explorer and right click a file, it will show a scripts submenu from where you can resize an image.
If you like right-click actions, I made a little script that installs it in your Nautilus right-click menu.
I didn’t know you preferred to reduce image size by percentage, resize it by a fixed size, or use custom dimensions, so I added all three options. You can also do this by selecting one or multiple image files at a time.
Copy and paste the command below in your terminal and press Enter:
If you want improve the script, you can do that the custom dimensions, was saved (for example in windows I have 3 different image’s dimensions saved foro default, one for thumbnail, one for main and one for category of the blog)
Also note:
When resizing an image, the ImageMagick software often tries to maintain the original image’s aspect ratio (the ratio of width to height). This means that when you change the width, the software calculates the corresponding height to maintain consistent proportions. If, after the conversion, you’re not seeing the exact height you chose, it’s likely because the calculated height would result in a distorted image if the original aspect ratio were not maintained.
For instance, if I perform the 800x800 conversion on an image that is originally 3517x1998, I would get a converted image of 800x454 that maintains the original aspect ratio.
Now, if you want the conversion to ignore your image’s aspect ratio and convert it to the exact size you specified, you need to add ! at the end of your size. So on the text editor, add 800x800! instead of 800x800