Thursday, April 25, 2024
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 3019  / 2 Years ago, sat, june 18, 2022, 9:36:16

This works:


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

I need the same without full-screen:


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

Have you an idea where I am wrong?


More From » command-line

 Answers
5

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

[#1335] Saturday, June 18, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rtbrbab

Total Points: 461
Total Questions: 126
Total Answers: 117

Location: Saudi Arabia
Member since Fri, Jul 1, 2022
2 Years ago
rtbrbab questions
Fri, May 5, 23, 14:22, 1 Year ago
Tue, Nov 16, 21, 14:41, 2 Years ago
Thu, Mar 23, 23, 20:47, 1 Year ago
Thu, Jan 6, 22, 01:23, 2 Years ago
;