Solved Default program for viewing images

As to how gimp is selected, here's a guess. I don't have gimp installed so I'll use firefox as an example.

In /usr/local/share/applications/ is firefox.desktop which has a mime type entry like this:
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
Note that image/gif and image/png and image/jpeg are included in that list.

In /usr/local/share/mime/application are XML files that map application specific mime-types to file glob expressions.
In /usr/local/share/mime/packages/freedesktop.org.xml are some common mime types like PNG and JPEG.

<mime-type type="image/jpeg">
<glob pattern="*.jpeg"/>


A DE could use these files to select a program by mapping file extension to mime-type and then picking an application whose *.desktop file matches the mime type.

Seems to me gio (thanks Espionage724 !) is a much better way to choose instead of hand editing a bunch of files.

Low level details here: https://specifications.freedesktop.org/desktop-entry/latest/
 
feh is great but can't display all images. At one time I used geeqie but moved on from it for reasons I don't recall. You might consider imagemagick7 which can do all kinds of image manipulation as well as display. Nowadays I often just use the browser.
 
What file manager are you using?

In most, like Thunar and Nemo, you just right click and choose Open With to set the default program:

openwith.png


I used graphics/viewnior for a long time now I switched to graphics/ristretto
 
Using Gimp for viewing pictures is indeed very inconvenient, since it's a program to manipulate/edit pictures, but no viewer.

What viewer I use depends on the purpose.
feh: /usr/local/bin/feh
graphics/feh
Second. feh is also my standard viewer, when I just want to take a quick look at a picture; quick, fast, simple and supports many formats.
Image Magick's display supports even more formats and provides some more features, but when I want to look at several pictures, having a slide show, or want to clean up a picture directory, so need overview like thumbnails, options like move or delete pictures etc, I use /graphics/nomacs/.
 
I prefer to use one that best fits the desktop environment in use.

Since I am using XFCE, for me it is: graphics/ristretto.

However, if you don't open images often or don't need additional options, using the web browser is perfectly fine too.
 
Iirc Ristretto didn't mouse-wheel zoom on cursor position, or zoomed laggy/non-accelerated (I mainly used it to open a game's world map jpg (9s vid); it'd open, I position cursor about where I'm at, then mouse-wheel zoom in)
 
I still use an expanded version of xzgv for my first-line picture sorting routine. A little annoying since you have to drag gtk+-1.x around but what can you do?
 
A lot of good opinions on viewers in this thread but no one is talking about library bloat. Most of discussed options are heavily tied to a particular desktop environment and drag a bunch of SO dependents into memory when you run them.

type ldd /path/to/viewer to see what kind of dependencies your viewer has.

In most cases your choice of viewer is tied to your choice of desktop environment (if you use one). For those of us who like lean X11 stuff the old standard was John Bradley's "XV" <https://en.wikipedia.org/wiki/Xv_(software)> but finding source and building on modern systems is non-trivial, as it hasn't been updated since about 1994.
 
I don't remember when I set things up, but feh is my default image viewer with a browser. To view an image with email, I use display (from ImageMagick) which I set up in mailcap. I *think* the reason I chose that was because whenever someone sends me a picture from their phone it's pretty big, but with display, there's an option to resize it. Or use
Code:
 magick <image> -resize <percent> <newimage>
.

e.g.
Code:
 magick sentimage1.jpg -resize 50% sentimage1.jpg
 
An example for graphics/gimageview:
Code:
% ldd /usr/local/bin/gimv | cut -w -f 4 | sort | uniq | xargs pkg which -o | cut -w -f 6 | sort | uniq | sed -e '/^the/d'
accessibility/at-spi2-core
archivers/brotli
converters/fribidi
converters/libiconv
devel/gettext-runtime
devel/glib20
devel/libdatrie
devel/libffi
devel/libthai
devel/pcre2
graphics/cairo
graphics/gdk-pixbuf2
graphics/graphite2
graphics/png
print/freetype2
print/harfbuzz
textproc/expat2
x11-fonts/fontconfig
x11-toolkits/gtk20
x11-toolkits/pango
x11/libX11
x11/libXau
x11/libxcb
x11/libXcomposite
x11/libXcursor
x11/libXdamage
x11/libXdmcp
x11/libXext
x11/libXfixes
x11/libXi
x11/libXinerama
x11/libXrandr
x11/libXrender
x11/pixman
%

Just for your convenience NOT to count by yourself:
Code:
% ldd /usr/local/bin/gimv | cut -w -f 4 | sort | uniq | xargs pkg which -o | cut -w -f 6 | sort | uniq | sed -e '/^the/d' | wc -l
      34
%
 
Back
Top