TIP: using sxiv image viewer

Forum Forums General Software TIP: using sxiv image viewer

  • This topic has 9 replies, 4 voices, and was last updated Jan 7-11:08 pm by Brian Masinick.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #49044
    Member
    PPC

      During the weekend, watching DistroTube, I rediscovered the image viewer that I used for many months on my (now defunct) old desktop: sxiv.
      It’s a very nice piece of software, with a crappy name (it stands for “Simple X Image Viewer”)

      It’s a small image image viewer and, using the old Linux, and antiX philosophy, does one thing, does it very well, and using the least resources possible.
      In a single core desktop, it open a 2-3Mb jpg image in about 1 second, while Mirage takes about 4 seconds to open and display the same image.

      It’s available in the repository (you can install it using Synaptic package manager, or, via terminal, with “sudo apt install sxiv”).
      You can use it’s output to perform actions on the selected image, but, if you want simpy to use it as a image viewer, it’s easy:
      1- install sxiv
      2- use it to open an image (via a file manager or the terminal : sxiv [image_name]

      It lacks one modern function- if you use it to open an image, you see only that image, and can’t load the next one…
      You can open all files on the folder (for example with: “sxiv *.jpg”, doing that does allow you see all images on the folder, and, if you right click it’s window, a thumbnail view.
      But… How do you get sxiv to open the file you selected and still see the next/previous files, or thumnails of all images on the folder?
      I had to recall how I did it about 1 year ago…
      I created a script that opened the selected image in sxiv and then told it to load all other images on the folder:

      #!/bin/bash
      #script to open selected image in sxiv, then, on right click, show thumbnails for current folder 
      sxiv -r -q $1 *.*

      Note: this work-around is far from perfect, but it mostly works… It does show all files in the current folder, but, after the selected file, it displays the first file from the folder, not the very next file…

      Save that script, make it executable, then, use it from your file manager to view files (if you like it, you can make it your default way to open image files.
      It’s very fast, even on slow hardware.

      How to use:
      click on the right side of the image to see the next image, click on the left side of the image to see the previous image, right click to get to the thumbnail view

      Keybindings (from http://manpages.ubuntu.com/manpages/trusty/man1/sxiv.1.html):
      n or Space- next picture
      p or Backspace – previous picture
      f – Toggle fullscreen mode
      b – Toggle visibility of info bar on bottom of window
      + – Zoom in.
      – – Zoom out.
      = – Set zoom level to 100%, or count%.
      w – Set zoom level to fit image into window.
      e – Set zoom level to fit image width to window width.
      E – Set zoom level to fit image height to window heigh

      More commands:

      Rotation
      < Rotate image counter-clockwise by 90 degrees.
      > Rotate image clockwise by 90 degrees.

      Flip
      \ Flip image horizontally.
      | Flip image vertically.

      Miscellaneous
      a Toggle anti-aliasing.
      W Resize window to fit image.

      EDIT:
      Improved version of the script, that displays the selected image in current folder, and allow to correctly see the next file or the previous file in the correct order, just like a “regular” image viewer:

      #!/bin/bash
      #get only image from CLI input, without path
      x=$1
      y=${x%}
      image_name=$(echo ${y##*/})
      #list all images to file images_list.txt
      ls -r  *.jpg *.jpeg *.png *.bmp *.gif > /tmp/images_list.txt
      tac /tmp/images_list.txt > /tmp/images_list_reversed.txt
      #Get number of selected image
      image_number=$(grep -n $image_name /tmp/images_list_reversed.txt | cut -f1 -d:)
      echo $image_number
      #pipe result of image list, starting by displaying the selected image number
      cat /tmp/images_list_reversed.txt | sxiv -i -n $image_number 

      P.

      • This topic was modified 2 years, 4 months ago by PPC.
      • This topic was modified 2 years, 4 months ago by PPC.
      • This topic was modified 2 years, 4 months ago by PPC.
      #49053
      Member
      manyroads
        Helpful
        Up
        0
        ::

        I find that none of the above keybindings work on my version of sxiv (from MX repos).

        Pax vobiscum,
        Mark Rabideau - http://many-roads.com
        "For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken
        dwm & i3wm ~Reg. Linux User #449130
        20 Jan 2021 ~ "End of an Error"

        #49054
        Member
        PPC
          Helpful
          Up
          0
          ::

          I find that none of the above keybindings work on my version of sxiv (from MX repos).

          I’m using antiX 19.X, and installed sxiv using apt.
          Only this keybings don’t seem to work (I don’t recall ever testing them all):

          = – Set zoom level to 100%, or count%.
          \ Flip image horizontally.

          P.

          #49056
          Member
          manyroads
            Helpful
            Up
            0
            ::

            I just installed all the sxiv-rifle materials from the AUR…. it works beautifully.

            If you go here you’ll find the two files you need:

            https://aur.archlinux.org/packages/sxiv-rifle/

            (I placed the sxiv-rifle.sh file in .local/bin and sxiv-rifle.desktop in .local/share/applications)

            EDIT @PPC btw. I think you’ll find a number of nice UI additions in sxiv-rifle.

            • This reply was modified 2 years, 4 months ago by manyroads.

            Pax vobiscum,
            Mark Rabideau - http://many-roads.com
            "For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken
            dwm & i3wm ~Reg. Linux User #449130
            20 Jan 2021 ~ "End of an Error"

            #49060
            Member
            PPC
              Helpful
              Up
              0
              ::

              @Manyroads- thanks… Now I recall, long ago, using sxiv-rifle… Strange how my script and sxiv-rifle do exactly the same thing but by different ways (I use my script only with spacefm, so I don’t even need a desktop file, but it could be handy for all other users…
              If you search on-line, you’ll even find ways to add keybindings to do stuff with the selected files in thumbnail mode (like copying, deleting, setting a file as wallpaper…- see DistroTube’s Sxiv review… it’s worth it- I only started watching it and installed sxiv in my home PC- it’s lightning fast even in my crappy old single core netbook
              I wonder why anticapitalista does not include such light image viewer in antiX… It’s not very “feature rich” – and it’s not supposed to be- it’s only a fast way to view image files or their thumbnails!

              P.

              #49062
              Member
              manyroads
                Helpful
                Up
                0
                ::

                Yes, I agree @ppc. I have sxiv-rifle set as my default image viewer. I love that it toggles between thumbnails and images immediately and that you can easily roll through large folders of images. All that and it is both light & blazingly fast.

                Pax vobiscum,
                Mark Rabideau - http://many-roads.com
                "For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken
                dwm & i3wm ~Reg. Linux User #449130
                20 Jan 2021 ~ "End of an Error"

                #49063
                Forum Admin
                anticapitalista
                  Helpful
                  Up
                  0
                  ::

                  How does it compare with shipped feh?

                  Philosophers have interpreted the world in many ways; the point is to change it.

                  antiX with runit - leaner and meaner.

                  #49069
                  Member
                  PPC
                    Helpful
                    Up
                    0
                    ::

                    @anticapitalista

                    Maybe feh feels a tiny bit faster opening files- but, it’s still under a second, even for quite large jpg files.. But sxiv (using sxiv-rifle or my script) also feels much more easier to handle – the thumbnail mode works great- and also sxiv can work with feh and use it to set wallpapers. One can configure, for example, the “Del” to delete selected files in t he thumbnail view, etc…
                    Sxiv just seems like more “modern” product to me, halfway between feh and mirage… but way faster than mirage. It open files automaticly configured to fit the window, and responds to the mouse in a more usual way…

                    P.

                    #49273
                    Member
                    PPC
                      Helpful
                      Up
                      0
                      ::

                      Off topic: Reading up on feh made me se the wisdom of anticapitalista default choices even more:

                      feh can, in fact, out of the box be used like sxiv, to view a file and then continue viewing all other files on the same folder…

                      feh --start-at [path_and_name_of_file]

                      It can be used with many options at the same time. If you want to open the image in full screen, and then continue viewing all other files in the folder, use the “-F” flag.
                      One very nice default option is using your file manager (rox or spacefm) to view thumbnails, then, when clicking a file, open it with feh, with all needed options:

                      feh --scale-down --auto-zoom -F --start-at %F

                      To do this:
                      1-right click an image file in SpaceFM ; Open > Select/Choose > enter the above command
                      2- view the file in feh and exit
                      3- right click an image with the same extension, Open > right click above “feh” with the gears icon and choose to make it default. Done

                      The feh manual (will all the option and key bindings) is over at: https://linux.die.net/man/1/feh

                      P.

                      #49302
                      Moderator
                      Brian Masinick
                        Helpful
                        Up
                        0
                        ::

                        Yeah, feh is about as light and “easy” as it can possibly be.

                        --
                        Brian Masinick

                      Viewing 10 posts - 1 through 10 (of 10 total)
                      • You must be logged in to reply to this topic.