[sane-devel] Epson Perfection V37/v200 support SANE.

Camil Băncioiu ioan.camil.bancioiu at gmail.com
Wed Sep 5 14:28:41 BST 2018


Sure, here's the modified "dip_apply_color_profile":

void
dip_apply_color_profile (const void *self, const buffer *buf,
                         const double profile[9])
{
  SANE_Int i;
  SANE_Byte *r_buf, *g_buf, *b_buf;
  double red, grn, blu;

  SANE_Byte *data;
  SANE_Int size;

  require (dip == self && buf && profile);

  log_info("Using %d bits per channel.", buf->ctx.depth);
  if (SANE_FRAME_RGB != buf->ctx.format)
    return;

  log_info("Buffer size: %d", size);

  if (16 == buf->ctx.depth) {
    uint16_t *p = (uint16_t *) buf->ptr;
    uint16_t *e = (uint16_t *) buf->end;

    uint16_t red_16, grn_16, blu_16;

    while (p < e)
    {
      red_16 = p[0];
      grn_16 = p[1];
      blu_16 = p[2];
      red =
        profile[0] * (red_16) + profile[1] * (grn_16) + profile[2] *
(blu_16);
      grn =
        profile[3] * (red_16) + profile[4] * (grn_16) + profile[5] *
(blu_16);
      blu =
        profile[6] * (red_16) + profile[7] * (grn_16) + profile[8] *
(blu_16);

      p[0] = clamp(red, 0, 0xFFFF);
      p[1] = clamp(grn, 0, 0xFFFF);
      p[2] = clamp(blu, 0, 0xFFFF);
      p += 3;
    }
  }

  if (8 == buf->ctx.depth) {

    data = buf->ptr;
    size = buf->end - buf->ptr;

    for (i = 0; i < size / 3; i++) {
      r_buf = data;
      g_buf = data + 1;
      b_buf = data + 2;

      red =
        profile[0] * (*r_buf) + profile[1] * (*g_buf) + profile[2] *
(*b_buf);
      grn =
        profile[3] * (*r_buf) + profile[4] * (*g_buf) + profile[5] *
(*b_buf);
      blu =
        profile[6] * (*r_buf) + profile[7] * (*g_buf) + profile[8] *
(*b_buf);

      *data++ = clamp (red, 0, 255);
      *data++ = clamp (grn, 0, 255);
      *data++ = clamp (blu, 0, 255);
    }
  }
}

Pay good attention to the compiling process, to ensure that the modified
driver properly replaces the default iscan driver. I think you had to pass
some very specific folder paths to the ./configure script (as command-line
arguments) to match with your system. This was required to make sure that
the driver finds the proper data files after compilation (the ones provided
by the iscan-data package).


On Tue, Sep 4, 2018 at 7:59 PM Robert A. Schmied <uwppp at flash.net> wrote:

> aloha camil
>
> i note your prior message dated 4 aug 18 in which you list function
> void dip_apply_color_profile of the iscan package -- is this the part
> you are referring to when you write ".. edit the driver source code .."?
>
> regardless, for us casual hackers more specifics as to what to
> edit/change would be extremely helpful and greatly appreciated.
>
>
> ras
>
>
>
> Camil Băncioiu wrote:
> > Unfortunately, on Linux you will not have 16-bit scanning, only 8-bit, if
> > that is important to you. Scanning at 16-bit can be enabled, but you need
> > to edit the driver source code and compile it yourself. I have done so.
> >
> > On Sun, Sep 2, 2018 at 8:06 PM Yuri Chornoivan <yurchor at ukr.net> wrote:
> >
> >
> >>вівторок, 21 серпня 2018 р. 13:23:51 EEST Виктор Рыжков написано:
> >>
> >>>Hello, sane-developers!
> >>>Help me please. I am work in Vologda State Library.
> >>>We switched from Windows to ALT Linux, and we had problems with the
> Epson
> >>>Perfestion V37/V200 scanners. There are no official Epson drivers on the
> >>>ALT Linux.SANE does not support them. Do you have the opportunity to
> help
> >>>us in this matter?
> >>>Yours faithfully, engineer of support Viktor Ryzhkov.
> >>
> >>Hi,
> >>
> >>You can use drivers from the hardware manufacturer:
> >>
> >>http://download.ebz.epson.net/dsc/search/01/search/searchModule
> >>
> >>Just enter "V37" then download packages for your distribution (ALT is
> RPM-
> >>based, you should choose 32- or 64-bits RPM). Install those RPMs.
> >>Interface is
> >>very similar to the one for Windows.
> >>
> >>Works fine here for Epson Perfection V330 Photo (same family) on Mageia
> 6,
> >>64-
> >>bits.
> >>
> >>Hope this helps.
> >>
> >>Best regards,
> >>Yuri
> >>
> >>
> >>
> >>
> >>--
> >>sane-devel mailing list: sane-devel at alioth-lists.debian.net
> >>https://alioth-lists.debian.net/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://alioth-lists.debian.net/pipermail/sane-devel/attachments/20180905/decae91a/attachment.html>


More information about the sane-devel mailing list