Как увеличить масштаб на 200% в feh без использования полноэкранного режима?

Это работает:

feh --zoom 200 --full-screen picturius.png

Мне нужно то же самое без полноэкранного режима:

feh --zoom 200 picturius.png # this does not work

У вас есть идеи, где я ошибаюсь?

3
задан 20 July 2021 в 02:11

2 ответа

feh basics

В Ubuntu я нахожу следующее описание в 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 работает для меня не только в полноэкранном режиме, но и с фиксированной геометрией в соответствии со следующим примером,

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

Shellscript, что делает feh --zoom приятнее

Следующий shellscript автоматически исправляет параметр геометрии для каждого,

#!/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

Сделать shellscript feh-zoom исполняемый файл и поместите его в каталог в PATH. Есть текст справки,

$ 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
7
ответ дан 28 July 2021 в 11:17

Спасибо, сэр, за вашу помощь!

Я вижу, что в следующий раз мне следует более внимательно прочитать руководство, но в любом случае уверен, что мне придется использовать следующую команду, чтобы увеличить изображение дважды?

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

Честно говоря, это звучит как плохая шутка. Или есть способ попроще?

1
ответ дан 28 July 2021 в 11:17

Другие вопросы по тегам:

Похожие вопросы: