This project has moved. For the latest updates, please go here.

Parameter problem with SaraffTwain 558

Feb 14 at 5:50 PM
Edited Feb 15 at 1:29 PM
Hello Andrei,

I am back again with a problem with the new SaraffTwain release 558.

I have updated my program (the CineStripScanner). I currently use an Epson Scanner (4990 and V750 Pro).
I normally use high resolutions (4400 dpi or even more). With my previous program version (October 2016) I could scan images with a resolution of 4400 dpi and a size of 24848 x 1333 pixels.
Now I can only scan images with a resolution of 3800 dpi and a size of 13951 x 1143 pixels.

Have there been any changes in the dll's that use much more storage so that the error message PARAMETER OUT OF RANGE occurs at much lower storage requests.
I detected this problem with Visual Studio 2015 Community exploiting .NET 4.6.1 in Debug mode.

New annotation: 2017/02/15 13:10 CET - I also tried .Net 4.5 - I got the same limitation.

Can you give a hint, what to do in order to get back the old image sizes.

Many thanks in advance.

Some more information. ( from dubugging output during program execution )---------------

1873 values originally provided in millimeters
1887 imgXF=2,04724, imgYF=1,581965,imgWidthF=4,340109, imgHeightF=0,3009836 (values in inches)
301 ParameterFile: stripResolution contains 4400
1890 _selectedResolution=4400
Der Thread 0x21ec hat mit Code 0 (0x0) geendet.
Der Thread 0x1810 hat mit Code 0 (0x0) geendet.
Der Thread 0x3108 hat mit Code 0 (0x0) geendet.
Der Thread 0x3ce4 hat mit Code 0 (0x0) geendet.
"CineStripScanner.exe" (Win32): "C:\Windows\twain_32\escndv\es0063\esimfl.dll" wurde entladen.
301 ParameterFile: stripNoFrames contains 24
301 ParameterFile: overlapFrames contains 1
2044 returned image height/ width = 1324 / 16948 ( values returned by SaraffTwain that is a image width of 3.85 inch versus 4.34 inches originally provided ---- image hight = 0.3009 versus 0.3009 which is correct )

2047 pBxStrip.Height =34, compression = 38,9411764705882
2047 e.Image.Width =16948, comImgWidth = 435,220543806647
301 ParameterFile: jpgQuality contains 90
2064 e_saved=Saraff.Twain.Twain32+EndXferEventArgs, e.Image =System.Drawing.Bitmap

This is the associated code for set Capabilities:

            Console.WriteLine("1887 imgXF="+imgXFC+", imgYF="+imgYFC+",imgWidthF="+imgWidthFC+", imgHeightF="+imgHeightFC);
            this._twain.ImageLayout = new RectangleF(imgXFC, imgYFC, imgWidthFC, imgHeightFC);

            _selectedResolution = theParmFile.GetParmFieldAsFloat("stripResolution");
            Console.WriteLine("1890 _selectedResolution=" + _selectedResolution);

             this._twain.ShowUI = false;

    private void _twain32_EndXfer(object sender, Twain32.EndXferEventArgs e)
        .  ......
                Console.WriteLine("2044 returned image height/ width = " + e.Image.Height + " / " + e.Image.Width);

                compression = (double) e.Image.Height / (double) pBxStrip.Height;
                Console.WriteLine("2047 pBxStrip.Height =" + (double)pBxStrip.Height + ", compression = " + compression);
                compImgWidth = (double) e.Image.Width / compression;
                Console.WriteLine("2047 e.Image.Width =" + (double) e.Image.Width + ", comImgWidth = " + compImgWidth);

These values show, that the provided image width is changed during the Acquire operations.

Regards Wolfgang
Feb 15 at 2:54 PM
Hello, Wolfgang.
I think that current problem don't related with new version of a Saraff.Twain.NET library. Try follow steps:
  1. give me information about a exception (message, a type of exception and a stack trace)
  2. try rollback current version of a Saraff.Twain.NET to previous version.
Feb 16 at 6:53 AM
Edited Feb 16 at 7:03 AM
Hello Andrei,

I will try to collect as much information as possible. I occationally get a message box with russian text which I am unable to read. But I think that has to do with the case, that the scanner sometimes looses conncetion to the program. Then I had also sometimes the message: "Parameter outside of allowed range" (but it is not said, which parameter - I asume it is related to the requested image dimesion and position) and I currently get a message "message out of sequence" although I definitely have not changed anything in the sequence of messages ( I asume this are the set capabilities messages) sent to twain32.
But I will check that again.

If there are screenshots and files, do you have a preference where the stuff to send to (an e-mail address).

What seems to be strange to me is, that up to end of January 2017 I could scan very long strips (24848 x 1333 Pixels - that are parts of a cine film) and I still had enough storage available to sharpen these strips with the Kaliko Image Library from Fredrik Schulz from Sweden. Kaliko seems to need .NET 4.5.
I had some small errors in my program related to the GUI in order ot define the scanning parameters and I tried to correct these errors - normally reading text boxes from the "define scanner parameters" dialog to store/save this input in a file and to convert then to float, double or int32.

If you are interrested: I will upload the source code of my program to my homepage just in case, you want to check during your investigation, what I did to trigger the scanner.
And this is a sample scan from early December 2016:

I desperately hope, that I did not make a stupid error.

Regards Wolfgang
Feb 16 at 3:20 PM
Edited Feb 16 at 3:21 PM
Hello Andrei,

SaraffTwain is rehabilitated. I think I have found the reason for the problem. It was my own program.
Not a stupid error. A pretty tricky one. I lost somehow the values of the scanning rectangle which created a "parameter out of range" message.
I tried a lot of things but finally making the values static was the breakthrough.

I am now able to scan filmstrips with a length of 135 mm and a height of 8 mm with a resolution of 4400 dpi which allows me to generate HD videos from Super 8 movies.

I think to not confuse other users, it is better to delete this thread.

I am - as you know - a strong fan of SaraffTwain.

I hope, I did not bother you too much. I do apologize for any inconvenience.

Marked as answer by SARAFF on 2/16/2017 at 10:23 AM