Feh 在圖像上顯示自訂文字

Feh 在圖像上顯示自訂文字

我正在嘗試找到一個feh圖像檢視器範例,您可以使用它在螢幕上顯示自訂文字。

我編寫了自己的應用程序,該應用程式正在執行一些操作,其中之一是在圖像螢幕上顯示,並且在圖像上還會顯示一些附加文本,這是我從伺服器回應中獲得的。

我找到的所有文件都沒有足夠的資訊。

--info [flag]command_line
          Execute command_line and display its output in the bottom left 
          corner of the image. Can be used to display e.g. image dimensions or 
          EXIF information. Supports FORMAT SPECIFIERS. If flag is set to “;”, 
          the output will not be displayed by default, but has to be enabled 
          by the toggle_info key.

是否有人有命令將文字顯示為輸入,或者也可以從指定檔案讀取文字。

答案1

您可以使用

--info "command"

在圖片的左下角顯示了命令的輸出。從man feh

--info [flag]commandline
        Execute commandline and display its output in the bottom left corner of
        the image.  Can be used to display e.g. image dimensions or EXIF informa‐
        tion.  Supports FORMAT SPECIFIERS.  If flag is set to ";", the output will
        not be displayed by default, but has to be enabled by the toggle_info key.

您也可以使用

--caption-path captions/

其中您有與圖片文件相關的名稱的文字文件,這些文件中的文字將在圖片底部附近橫向居中顯示。

-K, --caption-path path
        Path to directory containing image captions.  This turns on caption view‐
        ing, and if captions are found in path, which is relative to the directory
        of each image, they are overlayed on the displayed image.  E.g. with cap‐
        tion path "captions/", and viewing image "images/foo.jpg", the caption
        will be looked for in "images/captions/foo.jpg.txt".

也可以控製文字的大小,例如

--font "yudit/24" 

-e, --font font
        Set global font.  Should be a truetype font, resident in the current
        directory or the font directory, and should be defined in the form font‐
        name/points, like "myfont/12".

我不知道是否/如何將輸出從預設位置移動,除了透過空格和空行的輸出將實際文字推向右側或向上。


示範命令,

$ find
./captions
./captions/sudodus-background.png.txt
./sudodus-background.png

S feh --caption-path  captions/ --font "yudit/24" \
--info "echo '           This is output from an echo command\n\n'" \
sudodus-background.png

示範圖片,

在此輸入影像描述

答案2

feh --info "echo $mytext"會做你想做的事——echo只列印給出的參數。

若要從文件中讀取,請使用"cat $myfile"

相關內容