install zenity dan image magick
Create the Bash script: Create a script (e.g., resize_images.py)
#!/bin/bash
# Get the percentage from user input
percentage=$(zenity --entry --title="Resize Percentage" --text="Enter resize percentage (e.g., 50 for 50%):" --entry-text="50")
# Check if the user clicked Cancel
if [ $? -eq 1 ]; then
exit 0
fi
# Get the desired output format from user input
output_format=$(zenity --entry --title="Output Format" --text="Enter desired output format (e.g., jpg, png):" --entry-text="jpg")
# Check if the user clicked Cancel
if [ $? -eq 1 ]; then
exit 0
fi
# Loop through selected files
for file in "$@"; do
# Generate a new filename with the resize percentage and format
original_filename=$(basename "$file")
extension="${original_filename##*.}"
filename_without_extension="${original_filename%.*}"
new_filename="${filename_without_extension}_resize${percentage}.${output_format}"
# Resize and convert the image, saving it with the new filename
convert "$file" -resize ${percentage}% "$(dirname "$file")/$new_filename"
done
Open Thunar: Open Thunar file manager on your XFCE desktop.
Go to Edit -> Configure Custom Actions: In the Thunar menu, navigate to "Edit" and select "Configure Custom Actions."
Click the "+" button: This will allow you to add a new custom action.
Fill in the details:
Name: Give your custom action a name (e.g., Resize Images).
Description: Provide a short description of the custom action.
Command: Enter the command that will launch your script. You can create a Bash script and pass the selected files and the desired percentage as parameters. For example:
bash
Copy code
/home/debian/.config/Thunar/custom_actions/resize_images.py %f
thanks chat gpt