[sane-devel] Best way to stop scanimage?

Jeff Sadowski jeff.sadowski at gmail.com
Sun Oct 1 00:09:14 UTC 2017


Thank you for the input.

I'm redoing phpsane. I'll look at the others but I came up with a method
that seems to work a little better then I have seen so far. Like I
mentioned I'm using proc_open in a process that I put in the background and
to allow me to watch the image as it is being pulled. I am pulling the
selection interface I saw on phpsane. I talked to the developer of phpsane
and he suggested I rebuild it. I can successfully pull scanner specific
options and create a custom option list for them. I'll add the option to
stop and try it out. But I will caution other users on that. I will cache
options and scanner returns to speed things up.

I was even successful at allowing an array input in html :-)

On Sat, Sep 30, 2017 at 3:16 PM, Jeff <jffry at posteo.net> wrote:

> On 29/09/17 15:52, Jeff Sadowski wrote:
> > I am developing a php interface I'm calling it php saneng I have it on
> > bitbucket for now and using proc_open. I will send the signal via
>
> You are not the first. Have you looked at
> https://sourceforge.net/projects/phpsane/ or
> https://github.com/anomen-s/php-sane or https://github.com/sbs20/scanserv
> ?
>
> I should probably point a few things before you continue down the dark
> path of making a wrapper around scanimage.
>
> When I started writing gscan2pdf back in 2006, it was exactly that, a
> Gtk2 wrapper around scanimage, written in Perl.
>
> It seemed like a good idea to wrap scanimage at the time, but it quickly
> became clear that the problem is that you have no way of handling option
> reloads. You can make it work for one scanner easily enough, but in a
> general sense, it is impossible.
>
> You are completely at the whim of the backend if an option, e.g. source
> or depth, option force a reload. And they do, which changes unexpected
> things. For instance some scanners support one page size (i.e. scan
> size) for flatbed, and another for ADF.
>
> You can work around this by calling scanimage [extra options] --help
> every time the user changes an option, but this will be slow. You can
> make it quicker by caching the options, but this is error-prone.
>
> You will find that because of this, the order in which the options are
> set is vitally important. i.e. for the above example, you have to set
> the source option before the geometry options, as the range of geometry
> options is changed by source. And confusingly, some backends have
> different names for the same options.
>
> In the end, I wrote Perl bindings for the SANE API. This solved all of
> the above problems, as you then get reload callbacks:
>
> http://search.cpan.org/~ratcliffe/Image-Sane-0.14/
>
> However, it is non-trivial. Here is a tutorial on writing PHP extensions
> in C:
>
> http://web.archive.org/web/20110222035803/http://devzone.
> zend.com/article/1021
>
> Good luck.
>
> Regards
>
> Jeff
>
>
> --
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe your_password"
>              to sane-devel-request at lists.alioth.debian.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20170930/19a08cf7/attachment-0001.html>


More information about the sane-devel mailing list