Skip to content

Sane

SANE stands for "Scanner Access Now Easy" and is an application programming interface (API) that provides standardized access to any raster image scanner hardware (flatbed scanner, hand-held scanner, video- and still-cameras, frame-grabbers, etc.)

How to use scanner in the CentOS6

## sane 관련 패키지 검색 및 설치
yum search all sane
sudo yum -y install sane xsane xsane-common xsane-gimp

## USB 목록을 출력한다:
sudo lsusb

## 스캔 가능한 장치목록 출력: 
scanimage -L

## X-Window 기반 스캐너 툴 실행:
xsane

Command-line scan

아래와 같은 방법으로 명령행에서 스캔을 할 수 있다.

$ scanimage -d "smfp:usb;04e8;3469;071KB8KFBA00T6H" --format tiff > /home/share/scan.tiff

참고로, Node.js를 사용한 예제는 아래와 같다. (스캐너 관련 권한을 할당해야 웹으로 사용 가능하다)

var express = require('express');
var router = express.Router();

var exec = require('child_process').exec;
var cmd = 'scanimage -d "smfp:usb;04e8;3469;071KB8KFBA00T6H" --format tiff > /home/share/scan.tiff';

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'My-SCANNER' });
});

router.post('/scan', function(req, res, next) {
    exec(cmd, function(error, stdout, stderr) {
      // command output is in stdout
      console.log('scan!');
    });
  res.send('Send the scan query...<br />Please check the shared directory.');
});

module.exports = router;

Favorite site