[sane-devel] coolscan2 / Nikon LS8000: problems scanning 35mm sides

Joseph Sacco jsacco at gnome.org
Mon Apr 9 19:36:07 UTC 2007

Two problems are encountered when attempting to scan 35mm slides using a
Nikon LS8000 with the FH-835M 35mm mounted film holder.

(1) scan area is clipped
(2) frame offset is incorrect.

Scan Area Clipping
The scan area clipping problem occurs because:

* (0,0) is not the upper left hand corner of the film of first side.
The upper left hand corner of the film of the first side is located at

* the ranges of x and y are constrained:

   0 < x < 5904 
   0 < y < 4031

The y constraint can be worked around by utilizing the subframe option:

   --subframe 0..25.5968mm [0]
       Fine position within the selected frame

The x constraint is a major problem that produces clipping.

Ideally, the user should be able to specify the the upper left hand
corner of the scan area, its width and height:

    -l 0..5904pel (in steps of 1) [0]
        Left x value of scan area
    -x 0..5904pel (in steps of 1) [5904]
        Width of scan-area.
    -t 0..4031pel (in steps of 1) [0]
        Top y value of scan area
    -y 0..4031pel (in steps of 1) [4031]
        Height of scan-area.

so that:

   Xmax = l + max-width-of-scan-area
   Ymax = t + max-height-of-scan-area

Unfortunately, Xmax and Ymax are constrained within the source code to

   Xmax < max-with-of-scan-area   = 5904 
   Ymax < max-height-of-scan-area = 4031 

The constraints are defined in the code before l and t are known so they
are not easy to adjust [by someone who does not completely understand
the source code].  

What to do???

Not knowing the correct way to fix the problem, I applied a "hack" to
coolscan2.c. I scaled the range of both CS2_Option_XMAX and
CS2_option_YMAX by a factor of 1.25:

--- coolscan2.c-        2007-04-06 15:41:11.000000000 -0400
+++ coolscan2.c 2007-04-09 11:33:28.000000000 -0400
@@ -842,7 +842,7 @@
              range->min = 0;
-             range->max = s->boundaryx - 1;
+             range->max = 1.25*(s->boundaryx - 1);  /* jes hack: extend range of xmax */
              range->quant = 1;
              o.constraint.range = range;
@@ -882,7 +882,7 @@
              range->min = 0;
-             range->max = s->boundaryy - 1;
+             range->max = 1.25*(s->boundaryy - 1); /* jes hack: extend range of ymax */
              range->quant = 1;
              o.constraint.range = range;

The factor of 1.25 is somewhat arbitrary. I found by experimenting that
any factor that would increase the range of Xmax beyond 9999 did strange
things to the preview window of xsane-0.994. A factor of 1.25 seemed

Scaling CS2_Option_XMAX is necessary to avoid clipping in the X
direction. Scaling CS2_Option_YMAX is not necessary, because of the
subframe option.

Frame Offset Problem
The subframe option needs to be reset for each frame. This leads me to
believe that the spacing between the frames is incorrectly specified for
an LS8000 scanner in the source code. I believe, but am not really sure,
that the frame offset is specified as:

    s->frame_offset = s->resy_max * 1.5 + 1;  /* works for LS-30, maybe not for others */

    [note: s->resy_max = 4031]

The factor of 1.5 is probably not correct for the LS8000. So what should
it be? I really don't know. For what its worth:

        The FH-835M film carrier holds five 35mm slides. The "cutouts"
        for the slides which are about 2.7cm high are separated by about
One more thought...  Whatever changes made to the source code should
take into account what happens when a different coolscan3 scanner is
userd and when a different film holder is used, for example:

        * FH-835S 35mm strip film holder
        * FH-869S 120/220 stip film holder



jsacco [at] gnome [dot] org

More information about the sane-devel mailing list