Convert your image to JPG with a right click action.
Convert to JPG Thunar action

Jump Straight In!
Basic Tab
Name: Convert to JPG
Description: Convert images to JPG using ImageMagick
Command: bash ~/bin/convert-to-jpg.sh %N
Appearance Conditions Tab
File Pattern: *.png;*.PNG
Appears if selection contains: Image Files
To add a custom action open Thunar file manager from the menu select Edit -> Configure custom actions…
The Bash Script
#!/bin/bash
#
# Requires imagemagick.
#
# Example usage: bash ~/bin/convert-to-jpg.sh
#
# Thunar Action Setup
#
# Name: Convert to JPG
# Description: Convert images to JPG using ImageMagick
# Command: bash ~/bin/convert-to-jpg.sh %N
# Appearance Conditions
# File Pattern: *.png;*.PNG
# Appears if selection contains: Image Files
# Process each file passed as argument
for the_file in "$@"; do
output_file="${the_file%.*}.jpg"
convert "$the_file" "$output_file"
doneThe examples on this page use the bin directory within the user’s Home directory. Home -> User -> bin. Place the script in the bin folder.
What You’ll Need:
- Thunar File Manager: (Part of XFCE desktop environment)
- ImageMagick: A free, open-source software suite, used for editing and manipulating digital images.
- Installation: Open a terminal and run:
sudo apt install imagemagick(or the appropriate package manager command for your Linux distribution).
- Installation: Open a terminal and run:
- Bash Shell: (Typically pre-installed on most Linux distributions)
- A location to store the script. The recommended location is in your user’s
bindirectory (/home/<your_username>/bin).
Creating the Custom Action in Thunar:
- Open Thunar Configuration: From the Thunar menu, select Edit -> Configure custom actions….
- Add a New Action: Click the “+ Add” button to create a new custom action.
- Configure the Action Details:
| Field | Value | Description |
|---|---|---|
| Name: | Convert to JPG | The name that will appear in the right-click menu. |
| Description: | Convert images to JPG using ImageMagick | A brief explanation of what the action does. |
| Command: | bash /home/<your_username>/bin/convert-to-jpg.sh %N(Replace <your_username> with your actual username) | This command executes the convert-to-jpg.sh shell script located in your /home/<your_username>/bin/ directory. The script takes one argument, %N, which represents the filenames of the image you want to convert. The script converts the image using ImageMagick and saves the result as a JPG file. |
| Appearance Conditions Tab – File Pattern: | *.png;*.PNG | This allows the action to apply to PNG file type. |
| Appears if selection contains: | Image Files | This ensures the action only appears when you right-click on image files (e.g., JPG, PNG, TIFF). |
The Bash Script (convert-to-jpg.sh – Save this as a file named convert-to-jpg.sh in your /home/<your_username>/bin/ directory):