WINE tips: How to associate IrfanView with an image file type in Linux

In my previous post I showed how to install IrfanView with a WINEPREFIX. This time I’m going to show you how to associate IrfanView with a particular image file type so that IrfanView launches and opens a file of that type when you double-click on the file.

IrfanView is an excellent free (but not open-source) application for Windows, and I’ve been using it in Windows since 1997. But there are so many excellent image viewing and editing applications native to Linux that I’ve never needed or wanted to install IrfanView under WINE. GQview, Gwenview, KolourPaint and the GIMP have so far covered all my needs. Nevertheless, IrfanView is my favourite utility for viewing and manipulating image files in Windows, and I can understand why some people may want to run it in Linux.

The usual method of setting file associations in Linux does not work for IrfanView. For example, if you use KDE’s Kickoff > System Settings > File Associations to associate JPG files with IrfanView, IrfanView will indeed launch if you double-click on a JPG file, but you’ll be left staring at an empty IrfanView window, as if you had simply launched IrfanView directly.

However, there is a straightforward work-around for this problem, and it involves the use of a Bash script. You associate the file type with a Bash script that you create specifically to accept a Linux parameter for the file name and convert it to a format that WINE can pass to IrfanView when launching it. Here is how to do it.

I created a text file ~/ containing the following Bash script:

wine "/home/fitzcarraldo/.wine-irfanview/drive_c/Program Files/IrfanView/i_view32.exe" $File

I used a WINEPREFIX of $HOME/.wine-irfanview/ when I installed IrfanView, so replace “.wine-irfanview” with “.wine” if you installed IrfanView without a WINEPREFIX (i.e. if it is installed in the ~/.wine/ directory tree).

I made the file executable:

$ chmod +x /home/fitzcarraldo/

I then edited the command for ‘IrfanView 4.27’ in ‘Kickoff’ > ‘System Settings’ > ‘File Associations’ > ‘image’ > ‘jpeg’ > ‘Application Preference Order’ | ‘IrfanView 4.27’ > ‘Edit’ > ‘Application’ to be as follows:

/home/fitzcarraldo/ %f

That works fine: when I double-click on a JPG file in a Dolphin window, IrfanView launches and opens the file.

Of course, if you want IrfanView to be the default viewer for PNG files then you would perform the aforementioned steps for ‘Kickoff’ > ‘System Settings’ > ‘File Associations’ > ‘image’ > ‘png’.

As I wrote initially, there are several excellent image viewers and editors for Linux, so I did not keep IrfanView as my default image viewer in Linux. But I have left IrfanView installed under WINE, as I may yet want to use it under Linux at some point.

About Fitzcarraldo
A Linux user with an interest in all things technical.

9 Responses to WINE tips: How to associate IrfanView with an image file type in Linux

  1. David says:

    wine .wine/drive_c/Program\ Files/IrfanView/i_view32.exe “Z:\\$(echo “$@” | sed ‘s/\//\\/g’)” $@

    Save it ( is what i choose to call it), make it executable, then associate image-types with it by right-clicking on the type you want associated, Open With, and navigate to the script (which I simply save in my /home/username folder), for each file type you want associated. I put this together several years ago, didn’t like not having Irfanview at hand. 🙂

  2. Andabata says:

    Thanks for your efforts, Fitzcarraldo.
    IrfanView is however useful because opens, without problems, all the kind of TGA files (with RLE compression, saved from Gimp etc.).
    TGA files are a bit scorbutic with native graphic viewers on Linux …

  3. Kathy says:

    I was happy to find your post as it was exactly what I was trying to do, except I’ve not been able to make it work.

    I created and made executable a file of the name you suggested ( in my home directory :

    wine “/home/kb/.wine/drive_c/Program Files (x86)/IrfanView/i_view32.exe” $File

    And set jpg files to open with this command:
    /home/kb/ %f
    (I’m using Mint 15 Mate so I set it in the Caja file browser rather than in the Kickoff menu which I don’t have.)

    But nothing happens when I click on a jpg file after changing the setting from whatever the default was to:
    /home/kb/ %f

    Can you tell me what I am doing wrong? Thanks.

    BTW I have IrfanView 4.35 working under WINE with the command:
    wine “C:/Program Files (x86)/IrfanView/i_view32.exe”

    (I also tried David’s suggestion above but that did not work, either.)

    • Fitzcarraldo says:

      The method I described in my December 2010 post still works for me in 2013 with KDE in Gentoo Linux. I don’t use Mint Linux or the Mate desktop environment, so I do not know whether or not those are affecting your outcome. Have you tried any debugging? For example, I’d try the following experiment to check whether the variable $File is being derived correctly in your case:

      echo $File > test.txt

      Look in the file test.txt to see what it contains.

      Furthermore, have you checked that the file is on WINE’s Windows drive z: in your case? Perhaps the WINE Windows drive is different in your case?

      Also, as you are having success launching IrfanView by passing the Windows command “C:/Program Files (x86)/IrfanView/i_view32.exe” to WINE, have you tried the following Bash script instead?

      wine “C:/Program Files (x86)/IrfanView/i_view32.exe” $File

      (The above also assumes the drive is z:, but you need to find out if it is z: in your case.)

  4. Pingback: WINE tips: File associations of Windows applications in Linux | Fitzcarraldo's Blog

  5. Pingback: WINE tips: File associations for Windows applications in Linux (continued) | Fitzcarraldo's Blog

  6. manicalic says:

    It is 2016 and I could not get the above answers to work. I had to modify the ‘’ like this:

    wine "/mnt/win/Program Files/IrfanView/i_view32.exe" "z:$(echo $1 | tr '/' '\\')"  
  7. manicalic says:

    I could not get any of the above to work (Mint 17.3).
    I had to modify the launcher script like this:

    wine "/mnt/win/Program Files/IrfanView/i_view32.exe" "z:$(echo $1 | tr '/' '\\')"  

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: