使用PHP或BASH文件从扫描仪获取图像


get image from scanner with PHP or BASH file?

我可以用PHP或BASH文件从扫描仪获取图像并处理它吗?如果是,我该怎么做?

来自SANE项目的scanadf可用于从命令行驱动扫描器。

正如Thomas所提到的,SANE PROJECT允许您通过使用几个参数调用scanimage来扫描命令行。

要达到扫描文档并将其移动到特定位置的目的:

<?php
$mode = 'gray';
$reso = 150;
$path = '/my/document/path/myFile.jpg';
/* scan the document in Gray Scale, with 150dpi of resolution
 * pipe a call to convert the resulting document to a JPEG
 * save the document to your desired location
 */ 
exec("scanimage --mode ".$mode." --resolution ".$reso." | pnmtojpeg > ".path);
// check if the document exists...
// save the contents of $path to the database...
?>