mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
commit
eeeb50392d
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,193 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to View Images from the Linux Terminal)
|
||||
[#]: via: (https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
How to View Images from the Linux Terminal
|
||||
======
|
||||
|
||||
Linux has many GUI applications for viewing images.
|
||||
|
||||
But I have never tried any CLI applications to see it.
|
||||
|
||||
Fortunately while working with the **[ImageMagick tool][1]** I got a command to view an image from the terminal.
|
||||
|
||||
The command name is **“display”**, which is part of the ImageMagick tool.
|
||||
|
||||
This is a great tool that allows NIX users to view images from the terminal.
|
||||
|
||||
Also, I got another great tool called FIM for this purpose.
|
||||
|
||||
We will show you how to install and use it to view images from the Linux terminal.
|
||||
|
||||
These commands use the system’s framebuffer to display images directly from the command line.
|
||||
|
||||
### How to View Images from Terminal Using display Command
|
||||
|
||||
[ImageMagick][2] is a free and open source, feature-rich, command-line based image manipulation tool.
|
||||
|
||||
It used to create, edit, compose, or convert bitmap images.
|
||||
|
||||
It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, PDF, SVG and etc,.
|
||||
|
||||
It can resize, mirror, rotate, transform images, adjust image colors, apply various special effects, etc,.
|
||||
|
||||
It supports batch process, which allow you to processes all images at once.
|
||||
|
||||
### How to Install ImageMagick?
|
||||
|
||||
The ImageMagick package is included in the official repository of most Linux distributions. Use the distribution package manager to install it.
|
||||
|
||||
**Make a note:** Make sure you already have “**[Development Tools][3]**” installed on your Linux system as a prerequisite for this.
|
||||
|
||||
For **RHEL/CentOS 6/7** systems, use the **[yum command][4]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo yum install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
For **RHEL/CentOS 8** and **Fedora** systems, use the **[dnf command][5]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo dnf install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
For **Debian/Ubuntu** systems, use the **[apt command][6]** or **[apt-get command][7]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install imagemagick
|
||||
```
|
||||
|
||||
For **openSUSE** systems, use the **[zypper command][8]** to install ImageMagick
|
||||
|
||||
```
|
||||
$ sudo zypper install -y ImageMagick
|
||||
```
|
||||
|
||||
To view any image file, run display command as follows. You can close the image by pressing the **“Esc/q”** button.
|
||||
|
||||
```
|
||||
$ display bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
If you want to open the image with the specified size of the window, use the **“-geometry”** flag.
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
You can also input position information of the image with display command. The below command open your image 800 pixels from the top and 800 pixels from the top left corner of your desktop.
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600+800+800 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
If you want to resize the image with the display command, use the following format.
|
||||
|
||||
```
|
||||
$ display -resize 600x400 ~/Downloads/bird.jp
|
||||
```
|
||||
|
||||
Alternatively, you can use percentage to resize the image.
|
||||
|
||||
```
|
||||
$ display -resize 50% ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
### How to View Images from the Terminal Using fim Command
|
||||
|
||||
[FIM][10] is a lightweight global image viewer designed specifically for Linux.
|
||||
|
||||
But it is not limited to Linux and can be configured to run on other OS such as MS-Windows.
|
||||
|
||||
It’s highly customizable and scriptable image viewer for users who are familiar with software like the VIM text editor.
|
||||
|
||||
It displays the image in full screen and can be easily controlled using the keyboard shortcuts.
|
||||
|
||||
It is very lightweight tool because it only depends on certain libraries.
|
||||
|
||||
It can open many file formats and it can display images in the following video modes.
|
||||
|
||||
* Graphically, with the Linux framebuffer device
|
||||
* Graphically, under X/Xorg, using the SDL library
|
||||
* Graphically, under X/Xorg, using the Imlib2 library
|
||||
* Rendered as ASCII Art in any textual console, using the AAlib library
|
||||
|
||||
|
||||
|
||||
The right video mode gets auto-detected or selected at runtime, and may be opted in/out before build at configure time, if desired.
|
||||
|
||||
FIM stands for Fbi IMproved, which is the fork of the Fbi Image viewer.
|
||||
|
||||
FIM can be easily installed on Debian/Ubuntu based systems as the package is available in the distribution official repository. For other distributions, you may need to compile it from the source.
|
||||
|
||||
```
|
||||
$ sudo apt install fim
|
||||
```
|
||||
|
||||
Once installed, you can display an image using the following command.
|
||||
|
||||
```
|
||||
$ fim bird.jpg
|
||||
```
|
||||
|
||||
You can automatically zoom an image using the **“-a”** option.
|
||||
|
||||
```
|
||||
$ fim -a bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
If you want to open multiple image files in the current directory, use the wildcard to open them all. Use the **“Pageup/Down”** keyboard shortcuts to move to the next or previous image.
|
||||
|
||||
```
|
||||
$ fim -a *.jpg
|
||||
```
|
||||
|
||||
To view the image in ASCII format, you can use the **“-t”** flag.
|
||||
|
||||
```
|
||||
$ fim -t bird.jpg
|
||||
```
|
||||
|
||||
The below keyboard shortcuts allow you to control the images.
|
||||
|
||||
* PageUp/Down : Prev/Next image
|
||||
* +/- : Zoom in/out
|
||||
* a : Autoscale
|
||||
* w : Fit to width
|
||||
* ESC/q : Quit
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/resize-convert-images-from-linux-command-line/
|
||||
[2]: https://imagemagick.org/
|
||||
[3]: https://www.2daygeek.com/install-development-tools-on-ubuntu-debian-arch-linux-mint-fedora-centos-rhel-opensuse/
|
||||
[4]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/
|
||||
[5]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/
|
||||
[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[7]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[8]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
||||
[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[10]: https://www.nongnu.org/fbi-improved/#docs
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,76 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to use this KDE Plasma text editor)
|
||||
[#]: via: (https://opensource.com/article/20/12/kwrite-kde-plasma)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
How to use this KDE Plasma text editor
|
||||
======
|
||||
Part of the popular KDE Plasma desktop, KWrite hides a ton of useful
|
||||
features in a deceptively simple, easy-to-use interface.
|
||||
![Coding on a computer][1]
|
||||
|
||||
KWrite is a desktop text editor for KDE’s Plasma desktop. It’s meant to be a universal application that anyone can reasonably use when they need to jot down a quick note, write a school paper, do some programming, and/or anything else you can think to do with a text editor. It uses components of the [Kate editor][2] to create a simple interface but leverages those same components to provide a long list of useful features.
|
||||
|
||||
### Install
|
||||
|
||||
KWrite isn’t intended for general availability; it’s a component of the [Plasma desktop by KDE][3], so if you’re running Plasma, then you already have KWrite.
|
||||
|
||||
If you don’t run Plasma, then you can install Plasma, so you can either start using it along with KWrite or just use KWrite as needed. However, it’s intended as the default text editor for your Plasma desktop, so if you really want to use it as a standalone application, then it’s probably easier to just install Kate.
|
||||
|
||||
### Using KWrite
|
||||
|
||||
When you launch KWrite, you get what you’d expect from a text editor—a big empty field for typing, a menubar and toolbar at the top, and a status bar at the bottom. That’s all you really need to know before getting started. KWrite is an intuitive application, with toolbar buttons for the important activities such as opening and saving a file and a simple menu system for more advanced editing tasks.
|
||||
|
||||
![Kwrite terminal containing dark gray html code on white background][4]
|
||||
|
||||
Many of KWrite’s features are latent—they happen without you activating them yourself. For instance, should you open a file written in HTML, then KWrite highlights keywords (such as `class` and `id`) and recognizes code tags (such as `<p>` or `<div>`), and treats them differently than words of a natural language. The same happens when you load a file written in Python, and nothing happens for documents written primarily in a natural
|
||||
language.
|
||||
|
||||
Of course, you don’t have to choose between just HTML, Python, and your native tongue. KWrite has support for lots of languages and formats (and for many, it even has auto-completion options).
|
||||
|
||||
For users who want a text editor with more than just obvious auto-load features, there are options in the Edit, View, and Tools menus. For instance, you can activate dynamic spell checking, run scripts, bring up a command line, comment or uncomment a line, adjust indentation, display line numbers, and much more.
|
||||
|
||||
There are also some interesting options when launching KWrite from a terminal. For instance, if you know exactly what line you want to navigate to in a file, you can launch KWrite with a line number argument:
|
||||
|
||||
|
||||
```
|
||||
`$ kwrite --line 101 example.txt`
|
||||
```
|
||||
|
||||
You can also conveniently pipe the output of a command to KWrite using the `--stdin` (or just `-i` for short) option. For example, this command downloads the index page of [example.com][5] and displays the HTML in a new KWrite window:
|
||||
|
||||
|
||||
```
|
||||
`$ curl http://example.com | kwrite --stdin`
|
||||
```
|
||||
|
||||
### Try KWrite
|
||||
|
||||
I’ve always felt that one of KDE’s strengths is that its perceived complexity is flexible—if you want a simple desktop, you can essentially choose to ignore any feature you don’t want. KWrite is an example of how that flexibility can also apply to developers. Because Kate has been engineered with so many features, it’s possible for developers to reuse a subset of those features to create a cleaner and more focused version of an application.
|
||||
|
||||
KWrite is a single-document editor. It doesn’t have tabs, nor any awareness of a project. It’s intended for people who want to work on exactly one document at a time and who want the basics to be active by default, with a selection of powerful editing tools available when needed. Install the excellent Plasma desktop and try it today!
|
||||
|
||||
KDE originally stood for Kool Desktop Environment, but is now known by many as the K Desktop...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/kwrite-kde-plasma
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer)
|
||||
[2]: https://opensource.com/article/20/12/kate-text-editor
|
||||
[3]: https://opensource.com/article/19/12/linux-kde-plasma
|
||||
[4]: https://opensource.com/sites/default/files/uploads/kwrite-31_days_kwrite-opensource.png (Kwrite terminal containing dark gray html code on white background)
|
||||
[5]: http://example.com
|
@ -0,0 +1,193 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to View Images from the Linux Terminal)
|
||||
[#]: via: (https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
如何从 Linux 终端查看图像
|
||||
======
|
||||
|
||||
Linux 有很多用于查看图像的 GUI 应用。
|
||||
|
||||
但我从来没有尝试过用任何命令行应用来查看它。
|
||||
|
||||
幸运的是,在使用 **[ImageMagick 工具][1]**时,我得到了一个从终端查看图像的命令。
|
||||
|
||||
命令名是 **“display”**,它是 ImageMagick 工具的一部分。
|
||||
|
||||
这是一个很好的工具,允许类 UNIX 用户从终端查看图像。
|
||||
|
||||
此外,我还为此得到了另一个很好的工具,叫做 FIM。
|
||||
|
||||
我们将向你展示如何安装并使用它从 Linux 终端查看图像。
|
||||
|
||||
这些命令使用系统的帧缓冲直接从命令行显示图像。
|
||||
|
||||
### 如何使用 display 命令从终端查看图像
|
||||
|
||||
[ImageMagick][2] 是一个免费开源、功能丰富、基于命令行的图像处理工具。
|
||||
|
||||
它用于创建、编辑、合成或转换位图图像。
|
||||
|
||||
它可以读取和写入各种格式(超过 200 种)的图像,包括 PNG、JPEG、GIF、PDF、SVG 等。
|
||||
|
||||
它可以调整图像的大小、镜像、旋转、转换图像、调整图像颜色、应用各种特殊效果等。
|
||||
|
||||
它支持批处理,允许你一次处理所有图像。
|
||||
|
||||
### 如何安装 ImageMagick?
|
||||
|
||||
ImageMagick 软件包包含在大多数 Linux 发行版的官方仓库中。使用发行版软件包管理器来安装它。
|
||||
|
||||
**需要注意的是:**确保你的 Linux 系统上已经安装了 “**[Development Tools][3]**” 包,这是安装的前提条件。
|
||||
|
||||
对于 **RHEL/CentOS 6/7** 系统,请使用 **[yum 命令][4]** 安装 ImageMagick。
|
||||
|
||||
```
|
||||
$ sudo yum install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
在 **RHEL/CentOS 8** 和 **Fedora** 系统,使用 **[dnf 命令][5]** 安装 ImageMagick。
|
||||
|
||||
```
|
||||
$ sudo dnf install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
对于 **Debian/Ubuntu** 系统,使用 **[apt 命令][6]** 或 **[apt-get 命令][7]** 安装 ImageMagick。
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install imagemagick
|
||||
```
|
||||
|
||||
对于 **openSUSE** 系统,使用 **[zypper 命令][8]** 安装 ImageMagick。
|
||||
|
||||
```
|
||||
$ sudo zypper install -y ImageMagick
|
||||
```
|
||||
|
||||
要查看任何图像文件,请运行 display 命令,如下所示。你可以按下 **“Esc/q”** 按钮关闭图像。
|
||||
|
||||
```
|
||||
$ display bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
如果你想用指定的窗口大小打开图像,请使用 **“-geometry”** 标志。
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
你也可以通过 display 命令输入图像的位置信息。下面的命令可以从桌面的距顶部 800 像素和据左上角 800 像素处打开图像。
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600+800+800 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
如果你想用 display 命令调整图像的大小,请使用以下格式。
|
||||
|
||||
```
|
||||
$ display -resize 600x400 ~/Downloads/bird.jp
|
||||
```
|
||||
|
||||
另外,你也可以使用百分比来调整图片的大小。
|
||||
|
||||
```
|
||||
$ display -resize 50% ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
### 如何使用 fim 命令从终端查看图像。
|
||||
|
||||
[FIM][10] 是一个专门为 Linux 设计的轻量级全局图像查看器。
|
||||
|
||||
但它并不局限于 Linux,它也可配置在其他操作系统上运行,如 MS-Windows。
|
||||
|
||||
对于熟悉 VIM 文本编辑器等软件的用户来说,它是高度可定制和可脚本化的图像查看器。
|
||||
|
||||
它可以全屏显示图像,并且可以使用键盘快捷键轻松控制。
|
||||
|
||||
它是一款非常轻量级的工具,因为它只依赖于某些库。
|
||||
|
||||
它可以打开许多文件格式,它可以在以下视频模式下显示图像。
|
||||
|
||||
* 使用 Linux 帧缓冲设备图形化。
|
||||
* 在 X/Xorg 下,使用 SDL 库图形化
|
||||
* 在 X/Xorg 下,使用 Imlib2 库图形化。
|
||||
* 使用 AAlib 库,在任意文本控制台中以 ASCII 艺术形式呈现。
|
||||
|
||||
|
||||
|
||||
正确的视频模式会在运行时自动检测或选择,如果需要,可以在构建前配置时选择加入或去除。
|
||||
|
||||
FIM 是 Fbi IMproved 的缩写,是 Fbi Image Viewer 的分支。
|
||||
|
||||
FIM 可以很容易地安装在基于 Debian/Ubuntu 的系统上,因为该软件包在发行版的官方仓库中是可用的。对于其他发行版,你可能需要从源码编译它。
|
||||
|
||||
```
|
||||
$ sudo apt install fim
|
||||
```
|
||||
|
||||
安装完毕后,你可以使用以下命令显示图像。
|
||||
|
||||
```
|
||||
$ fim bird.jpg
|
||||
```
|
||||
|
||||
你可以使用 **“-a”** 选项自动缩放图像。
|
||||
|
||||
```
|
||||
$ fim -a bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
如果你要打开当前目录中的多个图像文件,请使用通配符将它们全部打开。使用 **“Pageup/Down”** 键盘快捷键移动到下一张或上一张图像。
|
||||
|
||||
```
|
||||
$ fim -a *.jpg
|
||||
```
|
||||
|
||||
要查看 ASCII 格式的图像,可以使用 **“-t”** 标志。
|
||||
|
||||
```
|
||||
$ fim -t bird.jpg
|
||||
```
|
||||
|
||||
下面的键盘快捷键可以让你控制图像。
|
||||
|
||||
* PageUp/Down:上一张/下一张图片。
|
||||
* +/-:放大/缩小
|
||||
* a:自动标度
|
||||
* w:适应宽度
|
||||
* ESC/q:退出
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/resize-convert-images-from-linux-command-line/
|
||||
[2]: https://imagemagick.org/
|
||||
[3]: https://www.2daygeek.com/install-development-tools-on-ubuntu-debian-arch-linux-mint-fedora-centos-rhel-opensuse/
|
||||
[4]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/
|
||||
[5]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/
|
||||
[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[7]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[8]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
||||
[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[10]: https://www.nongnu.org/fbi-improved/#docs
|
Loading…
Reference in New Issue
Block a user