How do I zoom 200% in feh without having to use fullscreen?

Solution 1:

feh basics

In Ubuntu I find the following description in man feh

 --zoom percent | max | fill
         Zoom images by percent when in full screen mode or when window
         geometry is fixed.  When combined with --auto-zoom, zooming will
         be limited to the specified percent.  Specifying max is like set‐
         ting --auto-zoom, using fill makes feh zoom the image like the
         --bg-fill mode.

Zoom works for me not only in full screen but also with fixed geometry according to the following example,

feh --zoom 200 --geometry 1500x500 zenity-info-message.png

Shellscript that makes feh --zoom nicer

The following shellscript fixes the geometry parameter automatically for each,

#!/bin/bash

function usage {

 echo "Help for ${0##*/} by Nio Wiklund <nio.wiklund at gmail.com>

Usage:
 ${0##*/} [--zoom <percent> [--position <+X+Y>]] <picture-1> [picture-2] [...]

Examples:

feh-zoom --zoom 200 picture.png
feh-zoom --zoom 50 --position +400+200 g*.jpg

    --zoom <percent>
        Zoom images by percent. Will create a correct window size automatically.
        . this option is modified in this shellscript compared to feh.
        
    --position <+X+Y>
        Position of the picture-window's top left corner
        (offset X pixels and Y pixels from the screen's top left cormer)
        . this is an option only for this shellscript, but not for feh.

    <picture-1> [picture-2] [...]
       . Specify at least one picture. Wild-card works, e.g. *.png
 
       . Switch to the next picture with 'q' (while you do it with -> in feh).
         Quit with 'qq' (press 'q' twice within one second).

       . The standard options for feh (for example --randomize) will fail
         because feh is called for one picture eash time in a for-loop, and
         no more options are passed.

If the first option is not --zoom, this shellscript passes control to feh
directly, so that all the standard options for feh will work.

General help for feh: man feh"
}
##############################
if [ "${1}" == "--zoom" ]
then
 shift
 if [ "$1" == "" ]
 then
  usage
 fi
 zoom="$1"

 shift
 if [ "$1" == "" ]
 then
  usage
 fi
 if [ "${1}" == "--position" ]
 then
  shift
  if [ "$1" == "" ]
  then
   usage
  fi
  position="$1"

  shift
  if [ "$1" == "" ]
  then
   usage
  fi
 fi
 cont=1
 for i in "$@"
 do
  if [ $cont -ne 0 ]
  then
   str="$(feh -l "$i"|tail -n1)"
   wide=$(<<< "$str" cut -f3)
   high=$(<<< "$str" cut -f4)
   wide=$((wide*zoom/100+1))
   high=$((high*zoom/100+1))
   geom="${wide}x${high}$position"
#   echo "$geom"
   feh --zoom "$zoom" --geometry "$geom" "$i"
   read -n1 -s -t1 ans
   cont=$?
  else
   exit 0
  fi
 done
elif [ "${1}" == "-h" ] || [ "${1}" == "--help" ]
then
 usage
else
 if [ "$1" == "" ]
 then
  feh
 else
  feh "$@"
 fi
fi

Make the shellscript feh-zoom executable and put it in directory in PATH. There is a help text,

$ feh-zoom -h
Help for feh-zoom by Nio Wiklund <nio.wiklund at gmail.com>

Usage:
 feh-zoom [--zoom <percent> [--position <+X+Y>]] <picture-1> [picture-2] [...]

Examples:

feh-zoom --zoom 200 picture.png
feh-zoom --zoom 50 --position +400+200 g*.jpg

    --zoom <percent>
        Zoom images by percent. Will create a correct window size automatically.
        . this option is modified in this shellscript compared to feh.
        
    --position <+X+Y>
        Position of the picture-window's top left corner
        (offset X pixels and Y pixels from the screen's top left cormer)
        . this is an option only for this shellscript, but not for feh.

    <picture-1> [picture-2] [...]
       . Specify at least one picture. Wild-card works, e.g. *.png
 
       . Switch to the next picture with 'q' (while you do it with -> in feh).
         Quit with 'qq' (press 'q' twice within one second).

       . The standard options for feh (for example --randomize) will fail
         because feh is called for one picture eash time in a for-loop, and
         no more options are passed.

If the first option is not --zoom, this shellscript passes control to feh
directly, so that all the standard options for feh will work.

General help for feh: man feh

Solution 2:

Thank you, sir, for your help!

I see I should read the manual more carefully next time, but anyway am I positive that I have to use the following command to zoom my picture twice?

feh  --zoom 200 --geometry $(feh  -l pictorius.png |  awk '(NR==2) {print(($3*2)"x"($4*2));}') pictorius.png 

Honestly, it sounds like a bad joke. Or is there a simpler way?