![如何在不使用全屏的情况下将 feh 放大 200%?](https://linux22.com/image/939666/%E5%A6%82%E4%BD%95%E5%9C%A8%E4%B8%8D%E4%BD%BF%E7%94%A8%E5%85%A8%E5%B1%8F%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E5%B0%86%20feh%20%E6%94%BE%E5%A4%A7%20200%EF%BC%85%EF%BC%9F.png)
这有效:
feh --zoom 200 --full-screen picturius.png
我需要同样的功能,但不全屏:
feh --zoom 200 picturius.png # this does not work
你知道我错在哪里吗?
答案1
feh
基本
在 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.
缩放功能不仅在全屏模式下有效,在固定几何体模式下也有效,如以下示例所示,
feh --zoom 200 --geometry 1500x500 zenity-info-message.png
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
使 shellscriptfeh-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
答案2
先生,谢谢您的帮助!
我知道下次我应该更仔细地阅读手册,但无论如何,我是否确定必须使用以下命令将图片放大两倍?
feh --zoom 200 --geometry $(feh -l pictorius.png | awk '(NR==2) {print(($3*2)"x"($4*2));}') pictorius.png
说实话,这听起来像个糟糕的笑话。或者有更简单的方法吗?