Running IrfanView on Ubuntu 22.10 using Wine

dan1ve

Daniel Veihelmann

Posted on February 24, 2023

Running IrfanView on Ubuntu 22.10 using Wine

I switched to Linux (Ubuntu 22.10) recently after using Windows for literally decades. While there are pros (like performance) and cons (like system stability) for this choice, I want to quickly describe one specific problem I faced, and how I solved it. Maybe this helps someone 😉

What is IrfanView?

IrfanView irfanview.com is one of the most popular image viewers there is. It is very quick and lightweight, but also has some pretty neat features to edit images quickly. While there is no native Linux support, it is possible to run IrfanView using Wine.

Problem: Scaling issues with IranView using Snap and Ubuntu 22.10

As it turned out, simply installing IrfanView using the Snap entry didn't work.

The main problem was that the scaling of the system menu on my 4K monitor didn't work, it was super tiny. Wine has an option to set a custom dpi value (via winecfg under Graphics), but this didn't affect IrfanView 😥

Solution: Use Wine without Snap

After a lot back and forth, I removed the snap version of IrfanView and tried Wine (stable) directly. This is as simply as downloading IrfanView's ZIP file and then running i_view32.exe with the Wine Windows Program Loader (via Open With) or wine i_view32.exe in the terminal.

And to me amazement, this worked immediately. No more unreadable system menu bars 🎉

There was only one more thing I wanted: It should be possible to open images directly with IrfanView (e.g. via Open With in the file browser).

To make a long story short, you need to do the following:

1. Create a .desktop file

Create a file IrfanView.desktop in your home folder. Don't forget to add the correct path instead of the two TODOs!

[Desktop Entry]
Name=IrfanView
Comment=Open Images with Irfanvieww
Keywords=image;
Exec=/usr/bin/env sh -c "winepath -w -0 %F | WINEPREFIX='/home/TODO: your user/.wine' xargs -0 wine /home/<TODO: YOUR PATH HERE>/irfanview/i_view32.exe"
Terminal=false
Type=Application
StartupNotify=true
MimeType=image/jpeg;image/png;
Enter fullscreen mode Exit fullscreen mode

The Exec section passes the target file to wine (and irfanview), but also uses winepath to transform the file path to a "Windows path" so that IrfanVIew understands it.

2. Register your application wrapper

In your home directory, run sudo desktop-file-install IrfanView.desktop

This validates the file you created, and adds it to the "Open With" applications.

Cheers!

💖 💪 🙅 🚩
dan1ve
Daniel Veihelmann

Posted on February 24, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related