From a884704a73067d9ce02d857f4c0ef35ced089323 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 1 Dec 2020 08:39:31 +0800 Subject: [PATCH] translated --- ...1 scanimage- scan from the command line.md | 75 ------------------- ...1 scanimage- scan from the command line.md | 75 +++++++++++++++++++ 2 files changed, 75 insertions(+), 75 deletions(-) delete mode 100644 sources/tech/20200711 scanimage- scan from the command line.md create mode 100644 translated/tech/20200711 scanimage- scan from the command line.md diff --git a/sources/tech/20200711 scanimage- scan from the command line.md b/sources/tech/20200711 scanimage- scan from the command line.md deleted file mode 100644 index e6f2412bd2..0000000000 --- a/sources/tech/20200711 scanimage- scan from the command line.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (scanimage: scan from the command line!) -[#]: via: (https://jvns.ca/blog/2020/07/11/scanimage--scan-from-the-command-line/) -[#]: author: (Julia Evans https://jvns.ca/) - -scanimage: scan from the command line! -====== - -Here’s another quick post about a command line tool I was delighted by. - -Last night, I needed to scan some documents for some bureaucratic reasons. I’d never used a scanner on Linux before and I was worried it would take hours to figure out. I started by using `gscan2pdf` and had trouble figuring out the user interface – I wanted to scan both sides of the page at the same time (which I knew our scanner supported) but couldn’t get it to work. - -### enter scanimage! - -`scanimage` is a command line tool, in the `sane-utils` Debian package. I think all Linux scanning tools use the `sane` libraries (“scanner access now easy”) so my guess is that it has similar abilities to any other scanning software. I didn’t need OCR in this case so we’re not going to talk about OCR. - -### get your scanner’s name with `scanimage -L` - -`scanimage -L` lists all scanning devices you have. - -At first I couldn’t get this to work and I was a bit frustrated but it turned out that I’d connected the scanner to my computer, but not plugged it into the wall. Oops. - -Once everything was plugged in it worked right away. Apparently our scanner is called `fujitsu:ScanSnap S1500:2314`. Hooray! - -### list options for your scanner with `--help` - -Apparently each scanner has different options (makes sense!) so I ran this command to get the options for my scanner: - -``` -scanimage --help -d 'fujitsu:ScanSnap S1500:2314' -``` - -I found out that my scanner supported a `--source` option (which I could use to enable duplex scanning) and a `--resolution` option (which I changed to 150 to decrease the file sizes and make scanning faster). - -### scanimage doesn’t output PDFs (but you can write a tiny script) - -The only downside was – I wanted a PDF of my scanned document, and scanimage doesn’t seem to support PDF output. - -So I wrote this 5-line shell script to scan a bunch of PNGs into a temp directory and convert the resulting PNGs to a PDF. - -``` -#!/bin/bash -set -e - -DIR=`mktemp -d` -CUR=$PWD -cd $DIR -scanimage -b --format png -d 'fujitsu:ScanSnap S1500:2314' --source 'ADF Front' --resolution 150 -convert *.png $CUR/$1 -``` - -I ran the script like this. `scan-single-sided output-file-to-save.pdf` - -You’ll probably need a different `-d` and `--source` for your scanner. - -### it was so easy! - -I always expect using printers/scanners on Linux to be a nightmare and I was really surprised how `scanimage` Just Worked – I could just run my script with `scan-single-sided receipts.pdf` and it would scan a document and save it to `receipts.pdf`!. --------------------------------------------------------------------------------- - -via: https://jvns.ca/blog/2020/07/11/scanimage--scan-from-the-command-line/ - -作者:[Julia Evans][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://jvns.ca/ -[b]: https://github.com/lujun9972 diff --git a/translated/tech/20200711 scanimage- scan from the command line.md b/translated/tech/20200711 scanimage- scan from the command line.md new file mode 100644 index 0000000000..a0609306f3 --- /dev/null +++ b/translated/tech/20200711 scanimage- scan from the command line.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (scanimage: scan from the command line!) +[#]: via: (https://jvns.ca/blog/2020/07/11/scanimage--scan-from-the-command-line/) +[#]: author: (Julia Evans https://jvns.ca/) + +scanimage:从命令行扫描! +====== + +这又是一篇关于我很喜欢的一个命令行工具的文章。 + +昨晚,出于官僚原因,我需要扫描一些文档。我以前从来没有在 Linux 上使用过扫描仪,我担心会花上好几个小时才弄明白。我从使用 `gscan2pdf` 开始,但在用户界面上遇到了麻烦。我想同时扫描两面(我知道我们的扫描仪支持),但无法使它工作。 + +### 遇到 scanimage! + +`scanimage` 是一个命令行工具,在 `sane-utils` Debian 软件包中。我想所有的 Linux 扫描工具都使用 `sane` (”scanner access now easy“) 库,所以我猜测它和其他扫描软件有类似的能力。在这里,我不需要 OCR,所以我们不打算谈论 OCR。 + +### 用 `scanimage -L` 得到你的扫描仪的名字 + +`scanimage -L` 列出了你所有的扫描设备。 + +一开始我不能让它工作,我有点沮丧,但事实证明,我把扫描仪连接到了我的电脑上,但没有插上电源。 + +插上后,它马上就能工作了。显然我们的扫描仪叫 `fujitsu:ScanSnap S1500:2314`。万岁! + +### 用 `--help` 列出你的扫描仪选项 + +显然每个扫描仪有不同的选项(有道理!),所以我运行这个命令来获取我的扫描仪的选项: + +``` +scanimage --help -d 'fujitsu:ScanSnap S1500:2314' +``` + +我发现我的扫描仪支持 `--source` 选项(我可以用它来启用双面扫描)和 `--resolution` 选项(我把它改为 150,以减少文件大小,使扫描更快)。 + +### scanimage 不支持输出 PDF 文件(但你可以写一个小脚本) + +唯一的缺点是:我想要一个 PDF 格式的扫描文件,而 scanimage 似乎不支持 PDF 输出。 + +所以我写了这个 5 行的 shell 脚本在一个临时文件夹中扫描一堆 PNG 文件,并将结果保存到 PDF 中。 + +``` +#!/bin/bash +set -e + +DIR=`mktemp -d` +CUR=$PWD +cd $DIR +scanimage -b --format png -d 'fujitsu:ScanSnap S1500:2314' --source 'ADF Front' --resolution 150 +convert *.png $CUR/$1 +``` + +我像这样运行脚本:`scan-single-sided output-file-to-save.pdf` + +你可能需要为你的扫描仪设置不同的 `-d` 和 `-source`。 + +### 这真是太简单了! + +我一直以为在 Linux 上使用打印机/扫描仪是一个噩梦,我真的很惊讶 `scanimage` 可以工作。我可以直接运行我的脚本 `scan-single-sided receipts.pdf`,它将扫描文档并将其保存到 `receipts.pdf`! +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/07/11/scanimage--scan-from-the-command-line/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972