高解像度コマンドライン画像ビューアtivを使ってみる

はじめに

tiv(Terminal Image Viewer)は、ターミナル上で高解像度の画像を表示できるコマンドライン画像ビューア。
RGB ANSIコードとUnicode文字を使用して、従来の画像ビューアよりも高品質な表示を実現している。

今回はtivを使って、ターミナルで画像を表示してみる。

環境

Windows 11 Pro
WSL2 (Ubuntu 24.04 LTS)
tiv 1.2.1
ImageMagick 6.9.12-98 Q16

前提条件

ImageMagickのインストール

tivImageMagickに依存しているため、事前にインストールしておく。

# ImageMagickのインストール
sudo apt update
sudo apt install imagemagick

# インストール確認
convert --version
ログ
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  crack-common gyp libcares2 libdouble-conversion3 libgl1-amber-dri libglapi-mesa libjs-async libjs-events
  libjs-inherits libjs-is-typedarray libjs-prettify libjs-regenerate libjs-source-map libjs-sprintf-js
  libjs-typedarray-to-buffer libllvm17t64 libmd4c0 libnotify-bin libpcre2-16-0 libqt5core5t64
  libqt5dbus5t64 libqt5gui5t64 libqt5network5t64 libqt5qml5 libqt5qmlmodels5 libqt5quick5 libqt5svg5
  libqt5waylandclient5 libqt5waylandcompositor5 libqt5widgets5t64 libqt5x11extras5 libre2-10 libssl-dev
  libuv1-dev libxcb-damage0 libxcb-xinerama0 libxcb-xinput0 mesa-utils-bin node-abbrev
  node-ampproject-remapping node-ansi-regex node-ansi-styles node-aproba node-are-we-there-yet node-arrify
  node-async node-async-each node-auto-bind node-babel-plugin-add-module-exports node-babel7-runtime
  node-balanced-match node-base64-js node-binary-extensions node-brace-expansion node-busboy
  node-camelcase node-caniuse-lite node-chownr node-chrome-trace-event node-ci-info node-cjs-module-lexer
  node-cli-boxes node-cli-cursor node-clone node-collection-visit node-color-convert node-color-name
  node-colors node-commander node-commondir node-concat-stream node-console-control-strings
  node-convert-source-map node-core-js node-core-js-pure node-core-util-is node-data-uri-to-buffer
  node-decompress-response node-deep-is node-defaults node-define-property node-delegates node-depd
  node-diff node-electron-to-chromium node-encoding node-end-of-stream node-err-code node-error-ex
  node-es-module-lexer node-escape-string-regexp node-eslint-utils node-eslint-visitor-keys node-esquery
  node-estraverse node-esutils node-events node-fancy-log node-fast-deep-equal node-fast-levenshtein
  node-fetch node-find-up node-flatted node-foreground-child node-fs-readdir-recursive
  node-fs-write-stream-atomic node-fs.realpath node-function-bind node-get-caller-file node-get-stream
  node-get-value node-glob node-globals node-got node-graceful-fs node-growl node-has-flag
  node-has-unicode node-has-value node-has-values node-hosted-git-info node-iconv-lite node-ieee754
  node-iferr node-imurmurhash node-indent-string node-inflight node-inherits node-ini node-interpret
  node-ip node-ip-regex node-is-arrayish node-is-binary-path node-is-buffer node-is-descriptor
  node-is-extglob node-is-path-cwd node-is-plain-obj node-is-plain-object node-is-stream
  node-is-typedarray node-is-windows node-isarray node-isexe node-isobject node-js-tokens node-json-buffer
  node-json-parse-better-errors node-json-schema node-json-schema-traverse node-json-stable-stringify
  node-jsonify node-jsonparse node-kind-of node-levn node-loader-runner node-locate-path
  node-lodash-packages node-lowercase-keys node-lru-cache node-map-visit node-memfs node-merge-stream
  node-mimic-response node-minimatch node-minimist node-minipass node-mute-stream node-n3 node-negotiator
  node-npm-run-path node-object-inspect node-object-visit node-once node-optimist node-optionator
  node-osenv node-p-cancelable node-p-limit node-p-locate node-p-map node-pascalcase node-path-dirname
  node-path-exists node-path-is-absolute node-path-is-inside node-path-type node-pify node-pkg-dir
  node-postcss-value-parser node-prelude-ls node-process-nextick-args node-promise-inflight
  node-promise-retry node-promzard node-prr node-pump node-punycode node-quick-lru node-randombytes
  node-read node-readable-stream node-rechoir node-regenerator-runtime node-regenerator-transform
  node-regexpp node-regjsgen node-repeat-string node-require-directory node-require-from-string
  node-resolve node-resolve-cwd node-resolve-from node-restore-cursor node-resumer node-retry
  node-run-queue node-safe-buffer node-serialize-javascript node-set-blocking node-set-immediate-shim
  node-shebang-command node-shebang-regex node-shell-quote node-signal-exit node-slash node-slice-ansi
  node-source-list-map node-source-map node-spdx-correct node-spdx-exceptions node-spdx-expression-parse
  node-spdx-license-ids node-sprintf-js node-ssri node-stack-utils node-string-decoder node-strip-bom
  node-supports-color node-tapable node-terser node-text-table node-through node-time-stamp
  node-to-fast-properties node-tslib node-type-check node-typedarray node-typedarray-to-buffer node-undici
  node-unicode-canonical-property-names-ecmascript node-unicode-match-property-value-ecmascript
  node-unicode-property-aliases-ecmascript node-unset-value node-uri-js node-util-deprecate node-uuid
  node-v8flags node-validate-npm-package-license node-wcwidth.js node-webpack-sources node-wordwrap
  node-wrappy node-write-file-atomic node-xtend node-y18n node-yallist node-yaml nodejs-doc
  qt5-gtk-platformtheme qttranslations5-l10n qtwayland5 xbitmaps
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  imagemagick-6.q16 libimath-3-1-29t64 libjxr-tools libjxr0t64 libmagickcore-6.q16-7-extra
  libmagickwand-6.q16-7t64 libnetpbm11t64 libopenexr-3-1-30 libwmflite-0.2-7 netpbm
Suggested packages:
  imagemagick-6-doc autotrace cups-bsd | lpr | lprng enscript gimp gnuplot grads graphviz hp2xx html2ps
  libwmf-bin mplayer povray radiance texlive-base-bin transfig libraw-bin inkscape
The following NEW packages will be installed:
  imagemagick imagemagick-6.q16 libimath-3-1-29t64 libjxr-tools libjxr0t64 libmagickcore-6.q16-7-extra
  libmagickwand-6.q16-7t64 libnetpbm11t64 libopenexr-3-1-30 libwmflite-0.2-7 netpbm
0 upgraded, 11 newly installed, 0 to remove and 57 not upgraded.
Need to get 4167 kB of archives.
After this operation, 16.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu noble/universe amd64 libmagickwand-6.q16-7t64 amd64 8:6.9.12.98+dfsg1-5.2build2 [318 kB]
Get:2 http://archive.ubuntu.com/ubuntu noble/universe amd64 imagemagick-6.q16 amd64 8:6.9.12.98+dfsg1-5.2build2 [254 kB]
Get:3 http://archive.ubuntu.com/ubuntu noble/universe amd64 imagemagick amd64 8:6.9.12.98+dfsg1-5.2build2 [14.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu noble/universe amd64 libimath-3-1-29t64 amd64 3.1.9-3.1ubuntu2 [72.2 kB]
Get:5 http://archive.ubuntu.com/ubuntu noble/universe amd64 libjxr0t64 amd64 1.2~git20170615.f752187-5.1ubuntu2 [181 kB]
Get:6 http://archive.ubuntu.com/ubuntu noble/universe amd64 libjxr-tools amd64 1.2~git20170615.f752187-5.1ubuntu2 [15.8 kB]
Get:7 http://archive.ubuntu.com/ubuntu noble/universe amd64 libopenexr-3-1-30 amd64 3.1.5-5.1build3 [1004 kB]
Get:8 http://archive.ubuntu.com/ubuntu noble/main amd64 libwmflite-0.2-7 amd64 0.2.13-1.1build3 [68.6 kB]
Get:9 http://archive.ubuntu.com/ubuntu noble/universe amd64 libmagickcore-6.q16-7-extra amd64 8:6.9.12.98+dfsg1-5.2build2 [70.1 kB]
Get:10 http://archive.ubuntu.com/ubuntu noble/universe amd64 libnetpbm11t64 amd64 2:11.05.02-1.1build1 [114 kB]
Get:11 http://archive.ubuntu.com/ubuntu noble/universe amd64 netpbm amd64 2:11.05.02-1.1build1 [2054 kB]
Fetched 4167 kB in 2s (1805 kB/s)
Selecting previously unselected package libmagickwand-6.q16-7t64:amd64.
(Reading database ... 113626 files and directories currently installed.)
Preparing to unpack .../00-libmagickwand-6.q16-7t64_8%3a6.9.12.98+dfsg1-5.2build2_amd64.deb ...
Unpacking libmagickwand-6.q16-7t64:amd64 (8:6.9.12.98+dfsg1-5.2build2) ...
Selecting previously unselected package imagemagick-6.q16.
Preparing to unpack .../01-imagemagick-6.q16_8%3a6.9.12.98+dfsg1-5.2build2_amd64.deb ...
Unpacking imagemagick-6.q16 (8:6.9.12.98+dfsg1-5.2build2) ...
Selecting previously unselected package imagemagick.
Preparing to unpack .../02-imagemagick_8%3a6.9.12.98+dfsg1-5.2build2_amd64.deb ...
Unpacking imagemagick (8:6.9.12.98+dfsg1-5.2build2) ...
Selecting previously unselected package libimath-3-1-29t64:amd64.
Preparing to unpack .../03-libimath-3-1-29t64_3.1.9-3.1ubuntu2_amd64.deb ...
Unpacking libimath-3-1-29t64:amd64 (3.1.9-3.1ubuntu2) ...
Selecting previously unselected package libjxr0t64:amd64.
Preparing to unpack .../04-libjxr0t64_1.2~git20170615.f752187-5.1ubuntu2_amd64.deb ...
Unpacking libjxr0t64:amd64 (1.2~git20170615.f752187-5.1ubuntu2) ...
Selecting previously unselected package libjxr-tools.
Preparing to unpack .../05-libjxr-tools_1.2~git20170615.f752187-5.1ubuntu2_amd64.deb ...
Unpacking libjxr-tools (1.2~git20170615.f752187-5.1ubuntu2) ...
Selecting previously unselected package libopenexr-3-1-30:amd64.
Preparing to unpack .../06-libopenexr-3-1-30_3.1.5-5.1build3_amd64.deb ...
Unpacking libopenexr-3-1-30:amd64 (3.1.5-5.1build3) ...
Selecting previously unselected package libwmflite-0.2-7:amd64.
Preparing to unpack .../07-libwmflite-0.2-7_0.2.13-1.1build3_amd64.deb ...
Unpacking libwmflite-0.2-7:amd64 (0.2.13-1.1build3) ...
Selecting previously unselected package libmagickcore-6.q16-7-extra:amd64.
Preparing to unpack .../08-libmagickcore-6.q16-7-extra_8%3a6.9.12.98+dfsg1-5.2build2_amd64.deb ...
Unpacking libmagickcore-6.q16-7-extra:amd64 (8:6.9.12.98+dfsg1-5.2build2) ...
Selecting previously unselected package libnetpbm11t64:amd64.
Preparing to unpack .../09-libnetpbm11t64_2%3a11.05.02-1.1build1_amd64.deb ...
Unpacking libnetpbm11t64:amd64 (2:11.05.02-1.1build1) ...
Selecting previously unselected package netpbm.
Preparing to unpack .../10-netpbm_2%3a11.05.02-1.1build1_amd64.deb ...
Unpacking netpbm (2:11.05.02-1.1build1) ...
Setting up libwmflite-0.2-7:amd64 (0.2.13-1.1build3) ...
Setting up libnetpbm11t64:amd64 (2:11.05.02-1.1build1) ...
Setting up libmagickwand-6.q16-7t64:amd64 (8:6.9.12.98+dfsg1-5.2build2) ...
Setting up libjxr0t64:amd64 (1.2~git20170615.f752187-5.1ubuntu2) ...
Setting up libimath-3-1-29t64:amd64 (3.1.9-3.1ubuntu2) ...
Setting up netpbm (2:11.05.02-1.1build1) ...
Setting up imagemagick-6.q16 (8:6.9.12.98+dfsg1-5.2build2) ...
update-alternatives: using /usr/bin/compare-im6.q16 to provide /usr/bin/compare (compare) in auto mode
update-alternatives: using /usr/bin/compare-im6.q16 to provide /usr/bin/compare-im6 (compare-im6) in auto mode
update-alternatives: using /usr/bin/animate-im6.q16 to provide /usr/bin/animate (animate) in auto mode
update-alternatives: using /usr/bin/animate-im6.q16 to provide /usr/bin/animate-im6 (animate-im6) in auto mode
update-alternatives: using /usr/bin/convert-im6.q16 to provide /usr/bin/convert (convert) in auto mode
update-alternatives: using /usr/bin/convert-im6.q16 to provide /usr/bin/convert-im6 (convert-im6) in auto mode
update-alternatives: using /usr/bin/composite-im6.q16 to provide /usr/bin/composite (composite) in auto mode
update-alternatives: using /usr/bin/composite-im6.q16 to provide /usr/bin/composite-im6 (composite-im6) in auto mode
update-alternatives: using /usr/bin/conjure-im6.q16 to provide /usr/bin/conjure (conjure) in auto mode
update-alternatives: using /usr/bin/conjure-im6.q16 to provide /usr/bin/conjure-im6 (conjure-im6) in auto mode
update-alternatives: using /usr/bin/import-im6.q16 to provide /usr/bin/import (import) in auto mode
update-alternatives: using /usr/bin/import-im6.q16 to provide /usr/bin/import-im6 (import-im6) in auto mode
update-alternatives: using /usr/bin/identify-im6.q16 to provide /usr/bin/identify (identify) in auto mode
update-alternatives: using /usr/bin/identify-im6.q16 to provide /usr/bin/identify-im6 (identify-im6) in auto mode
update-alternatives: using /usr/bin/stream-im6.q16 to provide /usr/bin/stream (stream) in auto mode
update-alternatives: using /usr/bin/stream-im6.q16 to provide /usr/bin/stream-im6 (stream-im6) in auto mode
update-alternatives: using /usr/bin/display-im6.q16 to provide /usr/bin/display (display) in auto mode
update-alternatives: using /usr/bin/display-im6.q16 to provide /usr/bin/display-im6 (display-im6) in auto mode
update-alternatives: using /usr/bin/montage-im6.q16 to provide /usr/bin/montage (montage) in auto mode
update-alternatives: using /usr/bin/montage-im6.q16 to provide /usr/bin/montage-im6 (montage-im6) in auto mode
update-alternatives: using /usr/bin/mogrify-im6.q16 to provide /usr/bin/mogrify (mogrify) in auto mode
update-alternatives: using /usr/bin/mogrify-im6.q16 to provide /usr/bin/mogrify-im6 (mogrify-im6) in auto mode
Setting up libjxr-tools (1.2~git20170615.f752187-5.1ubuntu2) ...
Setting up libopenexr-3-1-30:amd64 (3.1.5-5.1build3) ...
Setting up imagemagick (8:6.9.12.98+dfsg1-5.2build2) ...
Setting up libmagickcore-6.q16-7-extra:amd64 (8:6.9.12.98+dfsg1-5.2build2) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1.1ubuntu3) ...
Processing triggers for libc-bin (2.39-0ubuntu8.5) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for desktop-file-utils (0.27-2build1) ...
convert --version

Version: ImageMagick 6.9.12-98 Q16 x86_64 18038 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib

tivのインストール

Ubuntuパッケージからのインストール

# tivのインストール
sudo apt install tiv

# インストール確認
tiv --help
ログ
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  crack-common gyp libcares2 libdouble-conversion3 libgl1-amber-dri libglapi-mesa libjs-async libjs-events
  libjs-inherits libjs-is-typedarray libjs-prettify libjs-regenerate libjs-source-map libjs-sprintf-js
  libjs-typedarray-to-buffer libllvm17t64 libmd4c0 libnotify-bin libpcre2-16-0 libqt5core5t64
  libqt5dbus5t64 libqt5gui5t64 libqt5network5t64 libqt5qml5 libqt5qmlmodels5 libqt5quick5 libqt5svg5
  libqt5waylandclient5 libqt5waylandcompositor5 libqt5widgets5t64 libqt5x11extras5 libre2-10 libssl-dev
  libuv1-dev libxcb-damage0 libxcb-xinerama0 libxcb-xinput0 mesa-utils-bin node-abbrev
  node-ampproject-remapping node-ansi-regex node-ansi-styles node-aproba node-are-we-there-yet node-arrify
  node-async node-async-each node-auto-bind node-babel-plugin-add-module-exports node-babel7-runtime
  node-balanced-match node-base64-js node-binary-extensions node-brace-expansion node-busboy
  node-camelcase node-caniuse-lite node-chownr node-chrome-trace-event node-ci-info node-cjs-module-lexer
  node-cli-boxes node-cli-cursor node-clone node-collection-visit node-color-convert node-color-name
  node-colors node-commander node-commondir node-concat-stream node-console-control-strings
  node-convert-source-map node-core-js node-core-js-pure node-core-util-is node-data-uri-to-buffer
  node-decompress-response node-deep-is node-defaults node-define-property node-delegates node-depd
  node-diff node-electron-to-chromium node-encoding node-end-of-stream node-err-code node-error-ex
  node-es-module-lexer node-escape-string-regexp node-eslint-utils node-eslint-visitor-keys node-esquery
  node-estraverse node-esutils node-events node-fancy-log node-fast-deep-equal node-fast-levenshtein
  node-fetch node-find-up node-flatted node-foreground-child node-fs-readdir-recursive
  node-fs-write-stream-atomic node-fs.realpath node-function-bind node-get-caller-file node-get-stream
  node-get-value node-glob node-globals node-got node-graceful-fs node-growl node-has-flag
  node-has-unicode node-has-value node-has-values node-hosted-git-info node-iconv-lite node-ieee754
  node-iferr node-imurmurhash node-indent-string node-inflight node-inherits node-ini node-interpret
  node-ip node-ip-regex node-is-arrayish node-is-binary-path node-is-buffer node-is-descriptor
  node-is-extglob node-is-path-cwd node-is-plain-obj node-is-plain-object node-is-stream
  node-is-typedarray node-is-windows node-isarray node-isexe node-isobject node-js-tokens node-json-buffer
  node-json-parse-better-errors node-json-schema node-json-schema-traverse node-json-stable-stringify
  node-jsonify node-jsonparse node-kind-of node-levn node-loader-runner node-locate-path
  node-lodash-packages node-lowercase-keys node-lru-cache node-map-visit node-memfs node-merge-stream
  node-mimic-response node-minimatch node-minimist node-minipass node-mute-stream node-n3 node-negotiator
  node-npm-run-path node-object-inspect node-object-visit node-once node-optimist node-optionator
  node-osenv node-p-cancelable node-p-limit node-p-locate node-p-map node-pascalcase node-path-dirname
  node-path-exists node-path-is-absolute node-path-is-inside node-path-type node-pify node-pkg-dir
  node-postcss-value-parser node-prelude-ls node-process-nextick-args node-promise-inflight
  node-promise-retry node-promzard node-prr node-pump node-punycode node-quick-lru node-randombytes
  node-read node-readable-stream node-rechoir node-regenerator-runtime node-regenerator-transform
  node-regexpp node-regjsgen node-repeat-string node-require-directory node-require-from-string
  node-resolve node-resolve-cwd node-resolve-from node-restore-cursor node-resumer node-retry
  node-run-queue node-safe-buffer node-serialize-javascript node-set-blocking node-set-immediate-shim
  node-shebang-command node-shebang-regex node-shell-quote node-signal-exit node-slash node-slice-ansi
  node-source-list-map node-source-map node-spdx-correct node-spdx-exceptions node-spdx-expression-parse
  node-spdx-license-ids node-sprintf-js node-ssri node-stack-utils node-string-decoder node-strip-bom
  node-supports-color node-tapable node-terser node-text-table node-through node-time-stamp
  node-to-fast-properties node-tslib node-type-check node-typedarray node-typedarray-to-buffer node-undici
  node-unicode-canonical-property-names-ecmascript node-unicode-match-property-value-ecmascript
  node-unicode-property-aliases-ecmascript node-unset-value node-uri-js node-util-deprecate node-uuid
  node-v8flags node-validate-npm-package-license node-wcwidth.js node-webpack-sources node-wordwrap
  node-wrappy node-write-file-atomic node-xtend node-y18n node-yallist node-yaml nodejs-doc
  qt5-gtk-platformtheme qttranslations5-l10n qtwayland5 xbitmaps
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  tiv
0 upgraded, 1 newly installed, 0 to remove and 57 not upgraded.
Need to get 93.8 kB of archives.
After this operation, 268 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu noble/universe amd64 tiv amd64 1.2.1+dfsg-1 [93.8 kB]
Fetched 93.8 kB in 1s (71.7 kB/s)
Selecting previously unselected package tiv.
(Reading database ... 114535 files and directories currently installed.)
Preparing to unpack .../tiv_1.2.1+dfsg-1_amd64.deb ...
Unpacking tiv (1.2.1+dfsg-1) ...
Setting up tiv (1.2.1+dfsg-1) ...

ソースからのビルド

最新版を使用したい場合は、GitHubからソースをダウンロードしてビルドする。

# 必要なツールのインストール
sudo apt install git build-essential

# リポジトリのクローン
git clone https://github.com/stefanhaustein/TerminalImageViewer.git
cd TerminalImageViewer/src

# ビルド
make

# インストール(オプション)
sudo make install

基本的な使用方法

画像の表示

# 単一画像の表示
tiv image.jpg
cpu-01

※あまり解像度良くないような・・・?

複数画像の表示(サムネイル形式)

# 複数画像の表示(サムネイル形式)
tiv *.jpg

特定のフォルダ内の画像を表示

# 特定のフォルダ内の画像を表示
tiv /path/to/images/*.png

基本オプション

# ヘルプの表示
tiv --help

オプション一覧

オプション説明
-0文字最適化を無効にし、常に上半分ブロック文字を使用
-2, --256256色モードを使用(macOS Terminalで正しく表示するために必要)
-c <数値>‘dir’モードでのサムネイル列数を指定(デフォルト: 3)
-d, --dir‘dir’モードを強制(複数の入力がある場合は自動選択)
-f, --full‘full’モードを強制(単一の入力がある場合は自動選択)
--helpヘルプテキストを表示
-h <数値>最大出力高を指定した行数に設定
-w <数値>最大出力幅を指定した文字数に設定
-x新しいUnicode Teletext/レガシー文字を使用(実験的)
# 256色モードで表示(互換性向上)
tiv -256 image.jpg

# 文字最適化を無効にして表示
tiv -0 image.jpg

# 幅を指定して表示
tiv -w 80 image.jpg

# 高さを指定して表示
tiv -h 40 image.jpg

いくつかの画像形式の表示

tivImageMagickを使用するため、多くの画像形式に対応している。

# JPEG画像の表示
tiv photo.jpg

# PNG画像の表示
tiv screenshot.png

# GIF画像の表示
tiv animation.gif

# WebP画像の表示
tiv image.webp

# SVG画像の表示
tiv vector.svg

フォルダ内の画像一覧表示

# カレントディレクトリの全画像をサムネイル表示
tiv *

# 特定の拡張子のみ表示
tiv *.jpg *.png

# 再帰的に検索して表示(bashの場合)
find . -name "*.jpg" -exec tiv {} +

画像の詳細表示

# ファイル名を表示
tiv -f image.jpg

# より大きなサイズで表示
tiv -w 120 -h 60 image.jpg

# フルスクリーンサイズで表示
tiv -w $(tput cols) -h $(tput lines) image.jpg

高度な使用方法

表示品質の指定

# 高品質表示(デフォルト)
tiv image.jpg

# 256色モード(古いターミナル対応)
tiv -256 image.jpg

# 文字最適化無効(比較用)
tiv -0 image.jpg

# モノクロ表示
tiv -256 -0 image.jpg

サムネイル表示の調整

# サムネイルサイズを指定
tiv -w 20 -h 10 *.jpg

# ファイル名なしでサムネイル表示
tiv -s *.jpg

# より多くの画像を一度に表示
tiv -w 15 -h 8 /path/to/photos/*

トラブルシューティング

文字が正しく表示されない場合

  • Unicodeフォントをインストールする(Inconsolata、FiraCodeなど)
  • ターミナルの文字間隔設定を確認する
  • -0オプションで文字最適化を無効にして試す
# Unicodeフォントのインストール例
sudo apt install fonts-firacode fonts-inconsolata

# 文字最適化を無効にして表示
tiv -0 image.jpg

色が正しく表示されない場合

  • ターミナルがトゥルーカラーに対応しているか確認
  • -256オプションで256色モードを試す
# 256色モードで表示
tiv -256 image.jpg

# ターミナルのカラー対応確認
echo $COLORTERM

ファイル形式エラーが発生する場合

  • ImageMagickが正しくインストールされているか確認
  • サポートされていない形式の可能性
# ImageMagickのサポート形式確認
identify -list format

# 別の形式に変換してから表示
convert image.bmp image.jpg
tiv image.jpg

参考

おわりに

tivは、ターミナル環境で高品質な画像表示を実現する優秀なツール。
SSH接続時やGUI環境が使用できない状況でも、画像を確認できるのはいいなと思った。
とはいえ、解像度は普通に見る分にはあまりよくないので、あくまで確認用だなと感じる。

Hugo で構築されています。
テーマ StackJimmy によって設計されています。