Scan images in 16 bits

From Studiosg
Jump to navigationJump to search

Welcome to Simone Giustetti's wiki pages.


Languages: English - Italiano


Scan Images in 8 or 16 Bits ?

A lot of available scanners have hardware precise enough to capture colors in a value of bits higher than the standard 8 for each color channel. digital images usually store colors for each pixel in 32 bits: 8 bits for each channel (Red, Green, Blue) + 8 bits for the alpha channel used for transparency. The maximum number of colors is around 16 millions. Using a 16 bits setup instead of the standard 8 the levels count for each color is 65,536 instead of 256 and the total hues count gets to 2.8 millions billions. The additional 8 bits cannot be shown on a standard screen, but they are useful to preserve image quality from rounding errors, that pile up when applying consecutive updates to an image such as adjusting brightness/contrast, applying filters and more.

I usually work with black & white images and never gave much thought to the subject, but was recently required for help in using Image Scan for Linux in high color bit depth in order to scan some old diapositives to digital format. Many Epson / Seiko scanner specifications widely advertise the 48-bits per pixel option when scanning. Even old devices like my aging Perfection V200 came with the transparency adapter for film and diapositives. There is no option to set the color bit depth through the front end software. What's the problem ? Image Scan is. The Epson / Seiko provided acquisition program is written to internally use 8-bits per pixel only. A third party software, Vuescan for example, is required to use your device to the fullest.

Patching Iscan to Scan in 48-bits Color Bit Depth

Linux distro forums are full of help requests and warnings concerning Iscan and setting 16-bits color depth while scanning:

for example. Searching the Internet you'll find some customized Iscan releases adding the functionality to the original source code:

Sadly the patched source code is usually meant for a single distributions and I could not find anything Slackware Linux related.

A discussion in the Arch Linux forum mentioned a patch for the channel-usb.c file, redefining the data type for variables storing RGB values, increasing the size. A potential solution found, but it still needed porting to a recent Iscan release, one able to build on recent Slackware Linux releases. I mentioned in earlier pages:

the sad state of Iscan source code for recent Slackware and pointed out the need to use Iscan 2.30.1 and old versions of a compiler and glibc to build a working package.

Using the Slackware 14.2 SlackBuild script as a starting point, I slightly altered the patch, matching it to the script, dug out a virtual machine with a working Slackware 14.2 64 bits operating system, updated it to the last available patch set and built the patched Iscan source code. The resulting package apparently works without flaw and can scan images in both 24 and 48 bits color depth. I installed such package on my Slackware 15.0 Linux box and obtained a new success. The package works with a recent operating system release.

The Updated SlackBuild Script

Below you'll find a download link to an archive including the updated SlackBuild script and all of the patches used to build the package: SlackBuild script for Iscan with 16-bits color depth support enabled.

The Package

For ease of use, I provide download links for the package and its checksum values. Some tests were successfully executed with an Epson Perfection V200 scanner and Mr. Thomas Strom was so kind to carry on tests with his Epson Perfection V600. No other device was tested, but the patch updates the scanning back-en not any plug-ins and as such should work with every device for which a Linux plug-in exists. Sadly I cannot provide support for issues as I won't be able to reproduce nor fix them.

No package for Arm or 32 bits Intels ? I'm afraid not. The former because the Slackware 14.2 Arm port is not actively supported and was declared "end of life" the past April 2023. For the latter, nobody downloaded the 32 bits packages in the past 2 years. If you need them, please write me an e-mail and I'll dug out a proper virtual machine to build them.

How-to Set 48-bits Color bit Depth for Scans

The patch updates the epkowa back end to store color data for each pixel using 16 bits variables in place of the 8 standard ones. Sadly it adds no checkbox or menu entry to set the color depth through the GUI. To scan with 16-bits depth you can:

  1. Open a terminal and use the scanimage command setting the --depth option to 16.
  2. Use the Xsane scanning application, show the option window where a new drop down box will set the color depth.

A detail of the "Advanced Options" Xsane window.

Fig.1: A detail of the "Advanced Options" Xsane window.

A detail of the acquisition window of Skanlite for KDE.

Fig.2: A detail of the acquisition window of Skanlite for KDE.

Please note: the saved images will weight more or less three times the size of a standard scan.


Conclusions

Scanning images with a color depth higher than 8-bits for channel is a reality with Slackware Linux, using an Epson / Seiko device. Their devices have the required hardware to store color values in 16-bits registers readily available, but the provided software cannot cope with it. Patching the source code, the back-end can be enhanced in a way that adds 16-bits support. You'll need a GUI providing a proper control to set the color depth to a value other than the standard 8 bits. In the last part of the article I provided download links to an updated SlackBuild script and a test version of the Iscan package. They are provided in the hope that they will prove useful to Epson / Slackware Linux users, but with no guarantee whatsoever because I cannot test every existing device as I own but one. If you manage to successfully test your scanner, please e-mail me and I'll add a note in this very page. My thanks to Mr. Thomas Strom for the testing and feedback provided and to Markismus for the patch.


For any feedback, questions, errors and such, please e-mail me at studiosg [at] giustetti [dot] net


External links





Languages: English - Italiano