2022 Jan. 23.
参考ページ (HobNote)ImageMagick option
"-resize"で画像を縮小拡大し、"-geometry"で表示キャンバスの大きさとスクリーン上の位置を指定する。
display -resize WIDTHxHIGHT -geometry WIDTHxHIGHT+OffsetWidth+OffsetHight PictureFile
Sample
# get screen resolution ScreenX=$(xdpyinfo | grep dimensions | grep -Po -m 1 "[0-9]+x" | head -n 1) ScreenX=${ScreenX%x} ScreenY=$(xdpyinfo | grep dimensions | grep -Po -m 1 "x[0-9]+" | head -n 1) ScreenY=${ScreenY#x} # set display size DisplayX=$(( ${ScreenX} * ${Size} / 100 )) DisplayY=$(( ${ScreenY} * ${Size} / 100 )) # SIZE: ratio to screen-resolution. # Unit of SIZE is %.(Integer in 0-100) # Display-size of picture is SIZE(%) of screen-resolution. # get location of picture in screen case "${Loc}" in # Loc indicates area of screen in which picture is displayed. nw) # North West Geomet="${DisplayX}x${DisplayY}+0+0" ;; ne) # North East OffX=$(( ${ScreenX} - ${DisplayX} )) Geomet="${DisplayX}x${DisplayY}+${OffX}+0" ;; sw) # South West OffY=$(( ${ScreenY} - ${DisplayY} )) Geomet="${DisplayX}x${DisplayY}+0+${OffY}" ;; se) # South East OffX=$(( ${ScreenX} - ${DisplayX} )) OffY=$(( ${ScreenY} - ${DisplayY} )) Geomet="${DisplayX}x${DisplayY}+${OffX}+${OffY}" ;; ce) # Center OffX=$(( ${ScreenX} / 2 - ( ${DisplayX} / 2) )) OffY=$(( ${ScreenY} / 2 - ( ${DisplayY} / 2) )) Geomet="${DisplayX}x${DisplayY}+${OffX}+${OffY}" ;; *) echo "Illegal value for location." 1>&2 exit 1 ;; esac display -resize "${DisplayX}x${DisplayY}" -geometry "${Geomet}" PictureFile