AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1352729
Accepted
xerostomus
xerostomus
Asked: 2021-07-19 22:17:06 +0800 CST2021-07-19 22:17:06 +0800 CST 2021-07-19 22:17:06 +0800 CST

如何在无需使用全屏的情况下将 feh 放大 200%?

  • 772

这有效:

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

我需要没有全屏的相同:

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

你知道我哪里错了吗?

command-line
  • 2 2 个回答
  • 1900 Views

2 个回答

  • Voted
  1. Best Answer
    sudodus
    2021-07-20T00:43:59+08:002021-07-20T00:43:59+08:00

    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

    以下 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
    
    • 8
  2. xerostomus
    2021-07-22T11:49:05+08:002021-07-22T11:49:05+08:00

    谢谢您,先生,您的帮助!

    我知道下次我应该更仔细地阅读手册,但无论如何我是否肯定我必须使用以下命令将图片缩放两次?

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

    老实说,这听起来像是一个糟糕的笑话。或者有没有更简单的方法?

    • 1

相关问题

  • 如何从命令行仅安装安全更新?关于如何管理更新的一些提示

  • 如何从命令行刻录双层 dvd iso

  • 如何从命令行判断机器是否需要重新启动?

  • 文件权限如何工作?文件权限用户和组

  • 如何在 Vim 中启用全彩支持?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve