<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  
  
  <channel>
    <title>chrisjrob: scan</title>
    <link>https://chrisjrob.com</link>
    <atom:link href="https://chrisjrob.com/tag/scan/feed/index.xml" rel="self" type="application/rss+xml" />
    <description>GNU Linux, Perl and FLOSS</description>
    <language>en-gb</language>
    <pubDate>Fri, 13 Feb 2026 17:22:31 +0000</pubDate>
    <lastBuildDate>Fri, 13 Feb 2026 17:22:31 +0000</lastBuildDate>
    
    <item>
      <title>Ubuntu Simple Scan HP All in One</title>
      <link>https://chrisjrob.com/2016/01/02/ubuntu-simple-scan-hp-all-in-one/</link>
      <pubDate>Sat, 02 Jan 2016 12:14:12 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2016/01/02/ubuntu-simple-scan-hp-all-in-one</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/hp-j6410.jpg" align="right" alt="Featured Image">
         
         <p>At home we have an HP OfficeJet J6410 printer, which has worked brilliantly for years. 
Unlike every previous printer we’ve owned, this printer sits happily on our network and seems perfectly content to be used only very occasionally, whereon it willingly responds with decent quality prints and scans.</p>

<p>I have set up the printer with a static IP address and so the scanning is managed via the web interface <code class="language-plaintext highlighter-rouge">http://192.168.0.100/webScan</code>, whereon the scanned image opens a new tab in the browser, enabling you to save to wherever.</p>

<p>This printing and scanning Nirvana hit a road bump today, when it just instantly went to “Scan done” and failed to actually do anything.
Rebooting the laptop, the printer and clearing temporary internet files all failed to resolve the problem, as did changing from Chrome to Firefox.</p>

<!--more-->

<p>In desperation I tried running Ubuntu Simple Scan, but predictably enough it did not find the printer. 
A quick Internet search took me to <a href="https://help.ubuntu.com/community/HpAllInOne">this excellent Ubunutu community page</a>.</p>

<p>I opened a terminal and typed:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ hp-makeuri 192.168.0.100

CUPS URI: hp:/net/Officejet_J6400_series?ip=192.168.0.100
SANE URI: hpaio:/net/Officejet_J6400_series?ip=192.168.0.100
HP Fax URI: hpfax:/net/Officejet_J6400_series?ip=192.168.0.100

Done.
</code></pre></div></div>

<p>I then typed (taking the SANE URI from above):</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ simple-scan hpaio:/net/Officejet_J6400_series?ip=192.168.0.100
</code></pre></div></div>

<p>And it worked perfectly! Flushed with success I read on to see how to make this a permanent fixture, and it turned out that all I needed to do was configure the CUPS URI for the printer itself (it was previously set to something like <code class="language-plaintext highlighter-rouge">socket://192.168.0.100</code>):</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ vim /etc/cups/printers.com

DeviceURI hp:/net/Officejet_J6400_series?ip=192.168.0.100
</code></pre></div></div>

<p>And now simply running Ubuntu Simple Scan works perfectly.</p>

<p>Thank you Ubuntu community!</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>How To Scan to OCR From The Command Line</title>
      <link>https://chrisjrob.com/2011/10/24/how-to-scan-to-ocr-from-the-command-line/</link>
      <pubDate>Mon, 24 Oct 2011 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2011/10/24/how-to-scan-to-ocr-from-the-command-line</guid>
      <description>
       <![CDATA[
         
         <p>I just had to remind myself how to scan to OCR, and thought I would
share the results.</p>

<p>Before you start, you need to have sane installed, and you also need
tesseract-ocr - both should be available in your distros repositories.</p>

<!--more-->

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install sane-utils tesseract-ocr
</code></pre></div></div>

<p>Next you need to find out what scanners you have available, and you do
this with:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ scanimage -L
device `v4l:/dev/video0' is a Noname Vimicro USB Camera (Altair) virtual device
device `plustek:libusb:004:002' is a Epson Perfection 1250/Photo flatbed scanner)
</code></pre></div></div>

<p>Obviously the latter is my scanner.</p>

<p>Assuming you have a working scanner, the following is a simple two liner
to scan and OCR.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ scanimage -d 'plustek:libusb:004:002' --mode Lineart \
--format tiff -x 215 -y 297 --resolution 200 &gt; example.tif
</code></pre></div></div>

<p>And finally convert to text with tesseract:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ tesseract /tmp/example.tif example
</code></pre></div></div>

<p>You should now have a file example.txt in your current directory, which
you can open in any text editor.</p>

<p>Obviously this has limitations - it works for single-page A4 portrait
typed documents - but it gives you the basics.</p>

<p>You could probably experiment with the resolution, 200 worked for me,
so I didn’t bother trying anything else.  Traditionally the higher the 
resolution the better, but I seem to recall that tesseract works better
on 300 and below.</p>

<p>On my Epson Perfection 1250 I found that I needed to add the sane 
switch <code class="language-plaintext highlighter-rouge">--warmup-time 0</code> as otherwise it never finished warming up.</p>

<p>If you would prefer to OCR an existing PDF, which is another thing that
I find myself doing from time to time, then first convert it to a tif:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ convert -density 200 example.pdf -depth 8 /tmp/example.tif
</code></pre></div></div>

<p>And then run the above tesseract command.</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>LTSP | LTSP5 Scanning</title>
      <link>https://chrisjrob.com/2009/11/18/ltsp5-scanning/</link>
      <pubDate>Wed, 18 Nov 2009 12:29:45 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2009/11/18/ltsp5-scanning</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/ltsp_logo.png" align="right" alt="Featured Image">
         
         <h2 id="scanning-with-ltsp-5-in-debian-etch-or-lenny">Scanning with LTSP 5 in Debian Etch or Lenny</h2>

<p>At the time of writing these instructions worked for Etch, but have not been completed for Lenny.</p>

<h2 id="introduction">Introduction</h2>

<p><strong>This is a description for a scanner physically connected to a terminal (not to the server).</strong></p>

<!--more-->

<p>For LTSP scanning to work, you just need to remember that the roles are reversed - that is the client is the scanning server and the server is the scanning client.  With the exception of the fact that you have to chroot to get at the client, the set-up is an ordinary Linux network scanning set-up.</p>

<h2 id="configure-client">Configure client</h2>

<h3 id="install-client-packages">Install client packages</h3>

<p>You have to be root in the chroot LTSP client environment for the next steps:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo chroot /opt/ltsp/i386
# mount -t proc /proc /proc
# mount -t sysfs sys /sys
# apt-get install libexif12 libgphoto2-2 libgphoto2-port0 libieee1284-3 libltdl3 libsane libsane-extras sane-utils
# umount sys
# umount /proc
</code></pre></div></div>

<h3 id="user-saned-needs-an-additional-group">User ‘saned’ needs an additional group:</h3>

<p>Still in the chroot:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># usermod -a -G scanner saned
</code></pre></div></div>

<h3 id="modify-etcinetdconf-etch">Modify <code class="language-plaintext highlighter-rouge">/etc/inetd.conf</code> (Etch)</h3>

<p>Still in the chroot, open <code class="language-plaintext highlighter-rouge">/etc/inetd.conf</code> (e.g. with vi) and add at the end of the file (after ‘#:OTHER: Other services’) this line:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sane-port stream tcp nowait saned.saned /usr/sbin/saned saned
</code></pre></div></div>

<h3 id="modify-etcdefaultsaned-lenny">Modify <code class="language-plaintext highlighter-rouge">/etc/default/saned</code> (Lenny)</h3>

<p>The problem with this is that it will run for all users, which seems a bit pointless, should be possible to use an ldm rc.d script, but this did not work correctly for me.</p>

<p>Still in the chroot, open <code class="language-plaintext highlighter-rouge">/etc/default/saned</code> and change <code class="language-plaintext highlighter-rouge">RUN=no</code> to <code class="language-plaintext highlighter-rouge">RUN=yes</code>.</p>

<p>On an upgraded server, this was not enough, I also needed to symlink:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># cd /etc/rc2.d
# ln -s ../init.d/saned S99saned
</code></pre></div></div>

<h3 id="the-initial-openbsd-inetd-links-are-wrong-etch">The initial openbsd-inetd links are wrong. (Etch)</h3>

<p>Still in the chroot, Delete openbsd-inetd links  with:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># rm /etc/rc*/*openbsd*
</code></pre></div></div>

<p>Create new one’s:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># ln -s ../init.d/openbsd-inetd /etc/rc2.d/S20openbsd-inetd
# ln -s ../init.d/openbsd-inetd /etc/rc3.d/S20openbsd-inetd
# ln -s ../init.d/openbsd-inetd /etc/rc4.d/S20openbsd-inetd
# ln -s ../init.d/openbsd-inetd /etc/rc5.d/S20openbsd-inetd
# ln -s ../init.d/openbsd-inetd /etc/rc0.d/K20openbsd-inetd
# ln -s ../init.d/openbsd-inetd /etc/rc1.d/K20openbsd-inetd
# ln -s ../init.d/openbsd-inetd /etc/rc6.d/K20openbsd-inetd
</code></pre></div></div>

<p>Check if everything is fine:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># ls -l /etc/rc*/*openbsd*
</code></pre></div></div>

<h3 id="leave-chroot">Leave chroot</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># exit or [Ctrl]+[d]
</code></pre></div></div>

<h2 id="configure-server">Configure server</h2>

<h3 id="install-server-packages">Install server packages</h3>

<p>Thanks to the Debian package system it’s easy to get almost all software (as root):</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># apt-get install libsane libsane-extras sane-utils
</code></pre></div></div>

<h3 id="set-user-grants">Set user grants</h3>

<p>You have to set the saned group for every scanner user:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># usermod -a -G saned ~username~
</code></pre></div></div>

<h3 id="sanedconf-configuration-client">saned.conf Configuration (client)</h3>

<p>Modify the saned.conf file. Put the IP address of your server, e.g.:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/opt/ltsp/i386/etc/sane.d/saned.conf

#
# saned.conf
#
# The contents of the saned.conf  file  is  a  list  of  host  names,  IP
# addresses or IP subnets (CIDR notation) that are permitted to use local
# SANE devices. IPv6 addresses must be enclosed in brackets,  and  should
# always  be specified in their compressed form.
#
# The hostname matching is not case-sensitive.
#
~serverip~
</code></pre></div></div>

<h3 id="netconf-configuration-client">net.conf Configuration (client)</h3>

<p>Modify the net.conf file. Put the IP addresses &amp; names of your server, scanner terminal; client and localhost here, e.g.:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/opt/ltsp/i386/etc/sane.d/net.conf

# This is the net config file.  Each line names a host to attach to.
# If you list "localhost" then your backends can be accessed either
# directly or through the net backend.  Going through the net backend
# may be necessary to access devices that need special privileges.

localhost
~server-ip~
~server-hostname~
</code></pre></div></div>

<h3 id="modify-the-dllconf-client">Modify the dll.conf (client)</h3>

<p>Enable only two lines, one with ‘net’ and the other one with the name of your (!) scanner backend (for me: snapscan -&gt; works with Epson scanner).</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/opt/ltsp/i386/etc/sane.d/dll.conf

# enable the next line if you want to allow access through the network:
net
snapscan
#abaton
#agfafocus
#apple
#avision
#artec
#artec_eplus48u
#as6e
...
</code></pre></div></div>

<p>Here you find an overview of supported backends:</p>

<ul>
  <li>http://www.sane-project.org/sane-mfgs.html</li>
</ul>

<h3 id="modify-dllconf-server">Modify dll.conf (server)</h3>

<p>Modify dll.conf.  Enable only the line with ‘net’ (disable all others):</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/etc/sane.d/dll.conf

# enable the next line if you want to allow access through the network:
net
#abaton
#agfafocus
#apple
#avision
#artec
#artec_eplus48u
#as6e
...
</code></pre></div></div>

<h3 id="modify-netconf-server">Modify net.conf (server)</h3>

<p>Modify net.conf.  Put the IP address of your scanner terminal client (!) here, e.g.:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/etc/sane.d/net.conf

# This is the net config file.  Each line names a host to attach to.
# If you list "localhost" then your backends can be accessed either
# directly or through the net backend.  Going through the net backend
# may be necessary to access devices that need special privileges.
~client-ip~
</code></pre></div></div>

<p>Alternatively (and better in my opinion) is to script the scanner program, so that it starts with:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>SANE_NET_HOSTS=client-ip
export SANE_NET_HOSTS
scanimage &gt; test.pnm
</code></pre></div></div>

<p>See Alternative Configuration.</p>

<h2 id="restart-your-client-terminal">Restart your client terminal</h2>

<h2 id="restart-hplip-etch-only">Restart hplip (Etch only)</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo /etc/init.d/hplip restart
Stopping HP Linux Printing and Imaging System: hpiod hpssd.
Starting HP Linux Printing and Imaging System: hpiod hpssd.
</code></pre></div></div>

<h2 id="test">Test</h2>

<p>If it doesn’t work - take a look at your syslog.</p>

<h2 id="alternative-configuration">Alternative configuration</h2>

<p>If your client doesn’t have a static ip and hostname (as with the default ltsp set-up), then you can either configure <code class="language-plaintext highlighter-rouge">/etc/dhcp3/dhcpd.conf</code> to provide you with a static ip and hostname, or use this alternative scanner configuration.</p>

<h3 id="step-1-remove-all-client-references-above">Step 1: Remove all client references above</h3>

<p>Work back through the above configurations, commenting out all references to your client-ip and client-hostname.</p>

<h3 id="step-2-write-a-script">Step 2: Write a script</h3>

<p>Here is a simple test script to determine your client, and list your connected scanner:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>SANE_NET_HOSTS=`echo $SSH_CLIENT | cut -d " "  -f 1`
export SANE_NET_HOSTS
scanimage -L
</code></pre></div></div>

<p>You would need to modify this script to do something more useful with scanimage.</p>

<h2 id="references">References</h2>

<ul>
  <li>http://wiki.ltsp.org/twiki/bin/view/Ltsp/Debian#Scanning_with_LTSP_5_in_Debian_E</li>
  <li>http://wiki.ltsp.org/twiki/bin/view/Ltsp/Scanners</li>
  <li>http://www.enterprisenetworkingplanet.com/nethub/article.php/%203637076</li>
  <li>http://www.jumako.de/cms/index.php?option=com_content&amp;task=view&amp;id=26&amp;Itemid=31</li>
</ul>

       ]]>
      </description>
    </item>
    
    <item>
      <title>LTSP | LTSP4.2 Scanning</title>
      <link>https://chrisjrob.com/2009/03/21/ltsp4.2-scanning/</link>
      <pubDate>Sat, 21 Mar 2009 06:25:44 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2009/03/21/ltsp4.2-scanning</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/ltsp_logo.png" align="right" alt="Featured Image">
         
         <h2 id="enable-saned-on-terminal">Enable saned on terminal</h2>

<ul>
  <li>Edit <code class="language-plaintext highlighter-rouge">/opt/ltsp/i386/etc/lts.conf</code> and add <code class="language-plaintext highlighter-rouge">XINETD_SERVICES = "saned"</code> to the <code class="language-plaintext highlighter-rouge">[default]</code> or relevant terminal section</li>
  <li>Restart the terminal</li>
  <li>Run <code class="language-plaintext highlighter-rouge">scanimage -L</code> on workstation shell to verify that scanner has been detected</li>
</ul>

<!--more-->

<h2 id="usage">Usage</h2>

<ul>
  <li>Physically plug the scanner into the terminal using USB or parallel port.</li>
  <li>Edit <code class="language-plaintext highlighter-rouge">/etc/sane.d/net.conf</code> and add the hostname or address of client running saned</li>
  <li>Use xsane, OpenOffice.org, GIMP, or any other scanner-aware application, as they should now list the scanner.</li>
</ul>

<h2 id="alternative-to-netconf">Alternative to net.conf</h2>

<p>If you do not wish to add the host to net.conf (as shown above) then you can run the following:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ SANE_NET_HOSTS=`echo $DISPLAY | cut -d: -f1`
$ export SANE_NET_HOSTS
</code></pre></div></div>

<p><strong>This will only work for the life of the terminal window - so you will need to run the application from the command line. Alternatively add this to a script that does the scanning.</strong></p>

<h2 id="scanning-from-the-command-line">Scanning from the command line</h2>

<h3 id="check-scanner-detected">Check scanner detected</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ scanimage -L
</code></pre></div></div>

<h3 id="scan">Scan</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ scanimage -l 0 -t 0 -x 215 -y 297 --mode {Lineart|Gray|Color} --resolution {75..600} --format {pnm|tiff} --brightness {-100..100} --contrast {-100..100} &gt;test.pnm
</code></pre></div></div>

<h2 id="references">References</h2>

<ul>
  <li>http://wiki.ltsp.org/twiki/bin/view/Ltsp/Scanners</li>
</ul>


       ]]>
      </description>
    </item>
    
    <item>
      <title>Howto | Install Scanning in Wine</title>
      <link>https://chrisjrob.com/2009/03/21/install-scanning-in-wine/</link>
      <pubDate>Sat, 21 Mar 2009 06:16:07 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2009/03/21/install-scanning-in-wine</guid>
      <description>
       <![CDATA[
         
         <p>Ensure you install the same version as wine.  For me that meant installing as follows:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install -t 'etch-backports' libwine-sane
</code></pre></div></div>

<!--more-->

<p>This worked to a fashion for me; in that it brought up a rather poor scanner dialog, and triggered the scanner, but never completed the scan job.  That said, I was using saned on LTSP (i.e. via network) which may be a step too far for libwine-sane!</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>LTSP | Scanning</title>
      <link>https://chrisjrob.com/2008/06/24/ltsp-scanning/</link>
      <pubDate>Tue, 24 Jun 2008 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2008/06/24/ltsp-scanning</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/ltsp_logo.png" align="right" alt="Featured Image">
         
         <p>Since upgrading to LTSP5, our scanning has ceased to work.  I have created a Work in Progress page called <a href="/2009/11/18/ltsp5-scanning/">LTSP5 Scanning</a>.  Having worked through the instructions contained on that page, scanning is still not working.  The logs show that the request <code class="language-plaintext highlighter-rouge">scanimage -L</code> is being detected by the client and the client is confirming that the LTSP server has permission, but it is then failing with:</p>

<!--more-->

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Jun 24 12:16:55 juno scanimage: unable to open /var/run/hplip/hpssd.port: No such file or directory: prnt/hpijs/hplip_api.c 94
Jun 24 12:16:55 juno scanimage: unable to connect hpssd socket 50002: Connection refused: prnt/hpijs/hplip_api.c 719
</code></pre></div></div>

<p>Not realising that HP had any involvement in scanning on Linux, I assumed that this was a port conflict with some utilities installed on our HP server, but reading into the matter further I believe that this is because the client has detected that the scanner is an HP model and has attempted to run an HP scan utility that is not installed on the client.  Just guesses, if you have any ideas, please contact me.  Any useful messages will be posted here!</p>

       ]]>
      </description>
    </item>
    
  </channel> 
</rss>
