Image conversion with a right-click

Image file manipulation is typically associated with programs like Inkscape, Photoshop, or even MS Paint. A graphical user interface, however, isn’t a pre-requisite for manipulating images. Often it is overkill. Simple tasks such as resizing or converting file type can be achieved with little more than a right click (and the power of ImageMagick).

ImageMagick is a command-line, Swiss-army-knife of image manipulation. It can achieve all the usual manipulations: sharpen, rotate, resize, convert to grayscale, convert to a sketch. The list goes on… Instead of harnessing all its creative power, here I show how ImageMagick commands can be added to the right-click menu (in either Windows or Linux) to achieve simple changes without ever opening the file.

Note: Other command-line tools with similar capabilities can be used in place of ImageMagick’s magick or convert commands. For example, Ghostscript, Inkscape, or ps2pdf.

Instructions for Windows users

  1. Download  and install ImageMagick.
  2. Go to the “Send To” folder. To get there, type sendto in the address bar in Windows Explorer.
  3. In this folder, create a new text file with a .bat extension. This indicates that the file is a “batch” file, and will be treated as a command/script.
  4. Edit the batch file to include the desired command:
    • The simplest example of an ImageMagick command is
      magick input.png input_converted.jpg
    • Older versions (<v7) of ImageMagick used the convert command in place of magick
  5. Replace ‘input.png’ and ‘output.jpg’ with variables:
    • input.png becomes "%~dpnx1"
    • input_converted.jpg becomes "%~dpn1_converted.jpg"
    • This appears nonsensical, but it’s actually straightforward:

      The quotation marks shown are necessary
    • The total content of the batch file is therefore the following single command
      magick "%~dpnx1" "%~dpn1_converted.jpg"
  6. To invoke the batch script, right-click and go into the Send To menu:

    The five batch files provide a glimpse of the possible file manipulation
  7. Get creative and create batch files for every manipulation you find yourself repeating.


A likely reason for the above steps to not work as expected is because Windows cannot locate the magick command. Try the following:

  1. Logging out and back in.
  2. Head to the command prompt (Press Win + R, then type cmd, and hit enter), type magick, and hit enter. If you get an error, then the command is not on your path. Easiest solution is to unistall ImageMagick and reinstall. As noted above, older versions for ImageMagick use  convert, not magick.
  3. Add a second line to your batch file with the command pause. This will display the error produced by the batch file.

Instructions for Linux Users

Implementing right-click actions on Linux depends on the file manager used. The following instructions work for Nemo, but the early steps are reasonably generic. For example, the first four steps are the same for Nautilus (changing each mention of nemo to nautilus, of course).

  1. Download and install ImageMagick
    sudo apt-get imagemagick
  2. In the directory ~/.local/share/nemo/scripts create a shell file (let’s call it
    Edit the file to contain

    file_wo_ext=$(echo $file_in | cut -f 1 -d '.')
    convert "$file_in" "$file_wo_ext".png

    Note the use of convert. Newer versions (>v7) of ImageMagick use the command magick instead.

  3. Ensure the script is executable
    chmod +x
  4. The script is now available from the right-click menu via the “scripts” sub-menu
  5. To simplify things further, create a second file in ~/.local/share/nemo/actions (let’s call it convert2png.nemo_action)
    Edit the file to contain

    [Nemo Action]
    Exec=/home/username/.local/share/nemo/scripts/ "%F"
    Selection = any

    Be sure to replace username. Also, note the quotes around %F which are necessary if the filename has spaces in it.

  6. Note the final line of the nemo_action file. Right-clicking on a file with any of those three extensions will provide the option directly in the right-click menu.

Author: Ken Hughes

Post-doctoral research scientist in physical oceanography

4 thoughts on “Image conversion with a right-click”

  1. Nice post! Is it also possible to convert all tif or png files in one folder in one go? Preferably while putting them into their own subfolder? Whould you be willing to post the code for the 4 addtional menu items you show above in the “send to ” menu?

  2. I’m sure it’s possible to do all files at once, but it’d take some clever multi line batch scripting that I have limited experience with. I’ll have a look in a couple of days to see if I can find my old scripts for the other menu items

  3. Some of the other examples use tools other than imagemagick. You’ll need to install ghostscript (gs) and pdftops to make the second and third commands work, respectively. And change the absolute paths

    colour2bw.bat is
    magick “%~dpnx1” -colorspace gray “%~dpn1_bw%~x1”

    pdf_compress.bat is
    “C:\Program Files\gs\gs9.04\bin\gswin32c.exe” -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -r300 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=”%~dpn1_compress.pdf” “%~dpn1.pdf”

    pdf2eps.bat is
    “C:\Program Files\xpdf\pdftops.exe” -eps %~dpn1.pdf

  4. a ton of options when it comes to converting images with a right click, but a lot of those image-centric programs can really clutter up your right-click menu. SendTo-Convert puts one simple option in your context menu that converts images in seconds.

Comments are closed.

%d bloggers like this: