百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

AirSane

> 编程语言
开源

通过 Apple AirScan 将 SANE 扫描仪发布到 MacOS、Android 和 Windows。

361 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

通过 Apple AirScan 将 SANE 扫描仪发布到 MacOS、Android 和 Windows。

AirSane

AirSane is a SANE frontend, and a scanner server that supports Apple's AirScan protocol. Scanners are detected automatically, and published through mDNS. Acquired images may be transferred in JPEG, PNG, and PDF/raster format.

AirSane's intended purpose is to be used with AirScan/eSCL clients such as Apple's Image Capture, sane-airscan on Linux, and the eSCL client built into Windows 10 and 11.

In addition to the AirScan/eSCL server functionality, a simple web interface is provided.

Images are encoded on-the-fly during acquisition, keeping memory/storage demands low. Thus, AirSane will run fine on a Raspberry Pi or similar device.

Authentication and secure communication are supported in conjunction with a proxy server such as nginx (see the https readme file).

If you are looking for a powerful SANE web frontend, AirSane may not be for you. You may be interested in scanservjs instead.

AirSane implements the Mopria eSCL protocol as published here.

Regarding the mDNS announcement, and the basic working of the eSCL protocol, David Poole's blog was very helpful.

Usage

Web interface

Open http://machine-name:8090/ in a web browser, and follow a scanner link from the main page.

macOS

When opening 'Image Capture', 'Preview', or other applications using the ImageKit framework, scanners exported by AirSane should be immediately available.

In the 'Printers and Scanners' control panel, exported scanners will be listed with a type of 'Bonjour Scanner'.

A macOS compatible scanner plugin for the "GIMP" image editing software is provided here.

If you define a custom icon for your scanner (see below), note that you will have to use the scanner through 'Image Capture' once before it will be shown with this icon in 'Printers and Scanners'. This seems to be a bug in macOS at least up to Catalina.

Linux

Install the sane-airscan backend with

bash
sudo apt-get install sane-airscan

or whatever the packet manager of your distribution requires to install it. Using sudo nano /etc/sane.d/dll.conf, add a line "airscan", and prepend a # character before the "escl" entry if present. (There are two airscan backends, called "escl" and "airscan", but only "airscan" is compatible with AirSane.) When done, scanimage -L should list your AirSane devices, and SANE clients such as XSane or simple-scan should be able to scan from them.

Windows

eSCL support in Windows has been introduced in Windows 11 first, but is now available in Windows 10 as well:

Connecting to an AirSane scanner

Go to "Settings"->"Bluetooth & devices"->"Printers and Scanners." There, click "Add Device". AirSane devices will appear as devices to add, click "Add". Wait until the device appears in the list of devices below, click the device, and choose "Install app" or "Open scanner" in order to install the Microsoft scanner app, or open it if has been installed before. Note that Windows does not allow more than 4 AirSane scanners in total.

Mopria client on Android

As of version 1.4.10, the Mopria Scan App will detect all AirSane scanners and display them with name and icon. After choosing scan options, you will be able to scan to your android device.

Installation

Build and install from source for OpenWRT

Build files and instructions for OpenWRT are published here:

Build and install from source on macOS

AirSane may be run on a macOS installation in order to serve locally attached scanners to eSCL clients such as Apple Image Capture. For instructions, see the macOS README file.

Build and install from source on Debian/Ubuntu/Raspbian

Build

bash
sudo apt-get install libsane-dev libjpeg-dev libpng-dev
sudo apt-get install libavahi-client-dev libusb-1.*-dev
sudo apt-get install git cmake g++
git clone https://github.com/SimulPiscator/AirSane.git
mkdir AirSane-build && cd AirSane-build
cmake ../AirSane
make

Install

The provided systemd service file assumes that user and group 'saned' exist and have permission to access scanners. Installing the sane-utils package is a convenient way to set up a user 'saned' with proper permissions:

bash
sudo apt-get install sane-utils

Make sure that sudo scanimage -L lists all scanners attached to your machine. Listing scanners as user 'saned' should show all scanners as well:

sudo -u saned scanimage -L

If all scanners are listed for 'root' but none for 'saned,' you might have hit a bug in libsane. As a workaround, create a file /etc/udev/rules.d/65-libsane.rules with this content:

ENV{libsane_matched}=="yes", RUN+="/usr/bin/setfacl -m g:scanner:rw $env{DEVNAME}"

Double-check the location of the setfacl binary using which setfacl, adapt the line if necessary. Unplug and re-plug all scanners. sudo -u saned scanimage -L should now list all of them.

To install AirSane:

bash
sudo apt-get install avahi-daemon
make && sudo make install
sudo systemctl enable airsaned
sudo systemctl start airsaned
sudo systemctl status airsaned

Disable saned if you are not using it:

bash
sudo systemctl disable saned

Disable unused scanner backends to speed up device search:

bash
sudo nano /etc/sane.d/dll.conf

The server's listening port, and other configuration details, may be changed by editing '/etc/default/airsane'. For options, and their meanings, run

airsaned --help

By default, the server listens on all local addresses, and on port 8090.

To verify http access, open http://localhost:8090/ in a web browser. From there, follow a link to a scanner page, and click the 'update preview' button for a preview scan.

Optional configuration

Options in /etc/default/airsane

The options in /etc/default/airsane correspond to command line options of the airsaned program. The options, and their defaults, are:

INTERFACE=*

listen on named interface only

LISTEN_PORT=8090

listening port

UNIX_SOCKET=

listen on named unix socket

ACCESS_LOG=

HTTP access log file

HOTPLUG=true

repeat scanner search on hotplug event

RELOAD_DELAY=1

how long a hotplug reload is delayed (seconds)

MDNS_ANNOUNCE=true

announce scanners via mDNS

ANNOUNCE_SECURE=false

announce secure connection

ANNOUNCE_BASE_URL=

optional base URL, overrides listen-port and announce-secure options; if the URL's hostname part is %h or %H, it is replaced with the result of avahi_client_get_host_name(), or avahi_client_get_host_name_fqdn(), respectively; if the URL's port part is %p, it is replaced with the value of LISTEN_PORT

WEB_INTERFACE=true

enable web interface

RESET_OPTION=false

allow server reset from web interface

DISCLOSE_VERSION=true

disclose version information in web interface

RANDOM_PATHS=false

prepend a random uuid to scanner paths

COMPATIBLE_PATH=true

use /eSCL as path for first scanner

LOCAL_SCANNERS_ONLY=false

ignore SANE network scanners

OPTIONS_FILE=/etc/airsane/options.conf

location of device options file

IGNORE_LIST=/etc/airsane/ignore.conf

location of device ignore list

ACCESS_FILE=/etc/airsane/access.conf

location of access file

Options in the options.conf file

In addition to the options that may be configured through /etc/default/airsane, it is possible to configure options to be used when scanning from a certain device. To specify such options, create a file /etc/airsane/options.conf, readable by user saned.
This file may contain the following kinds of lines:

  • Empty lines, and comment lines starting with #, will be ignored.
  • Lines beginning with the word device, followed with a regular expression,
    will begin a device section that applies to all devices with SANE device name or make-and-model string matching the regular expression.
  • Lines beginning with an option name, and an option value separated by white space, will define an option.
    Options at the top of the file are applied to all scanners. If a scanner matches multiple device lines,
    options from all of these device sections will be applied.
    Options may be SANE backend options, or AirSane device options (see below).

SANE backend options

To display the SANE options supported by a device, use sudo -u saned scanimage -L to get its SANE name, and then sudo -u saned scanimage -d -A to get a list of options.
In options.conf, SANE options must be given without leading minus signs, and with white space between the option's name and its value. White space is removed from the beginnning and the end of the value.

AirSane device options

gray-gamma

A gamma value that is applied to grayscale image data before transmission. The gamma value is given as a floating-point value.

color-gamma

A gamma value that is applied to color image data before transmission, using identical gamma values for all components.

synthesize-gray

A value of yes or no. If set to yes, AirSane will always request color data from the SANE backend, even if the user requests a grayscale scan. In this case, grayscale values will be computed from RGB component data after gamma correction, using weights as suited for sRGB data:
Y = 0.2126 * R + 0.7152 * G + 0.0722 * B
This is useful for backends that do not allow true grayscale scanning or incorrectly return a single color component even if true gray is requested (observed with the SANE genesys backend).

icon

Name of a png file that should be used as the scanner's icon. This may be an absolute path, or a relative path. If relative (e.g., just a file name without a path), it is relative to the location of the options file.

The image should have a size of 512x512, 256x256 or 128x128 pixels and an alpha channel for transparency. If pixel dimensions are not powers of two, the image will not be accepted by macOS.

location

A string that appears in the note field of the mDNS announcement. This should be an indication where the scanner is located, such as "Living Room" or "Office." If no location is given in the options file, this defaults to the host name of the machine that runs airsaned.

Example options.conf file

# Example options.conf file for airsane
# Set SANE brightness to 10 for all scanners
brightness 10
# Set a default icon for all scanners
icon Gnome-scanner.png

# Compensate for OS-side gamma correction with gamma = 1.8 = 1/0.555555
gray-gamma 0.555555
color-gamma 0.555555

# Set options for all scanners using the genesys backend
device genesys:.*
synthesize-gray yes

# Set icon and calibration file option for a scanner "Canon LiDE 60"
device Canon LiDE 60
icon CanonLiDE60.png
location Living Room
calibration-file /home/simul/some path with spaces/canon-lide-60.cal

Color Management (Gamma Correction)

When receiving scan data from an AirScan scanner, macOS seems to ignore all color space related information from the transmitted image files, and interprets color and gray levels according to standard scanner color profiles. Using ColorSync Utility, one can see that these color profiles are called Scanner RGB Profile.icc and Scanner Gray Profile.icc, located at /System/Library/Frameworks/ICADevices.framework/Resources. Unfortunately, it is not possible to permanently assign a different color profile to an AirScan scanner using ColorSync Utility: the specified color profile is not used, and the profile setting is reverted to the original standard profile.

The SANE standard does not prescribe a certain gamma of backend output.

The macOS standar

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++airscanandroidapple-image-captureescl

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言