T O P I C R E V I E W |
CC_ImgDev |
Posted - Mar 04 2016 : 11:52:11 Hi, I have an issue that I have not been able to fully resolve with Twain Scanning.
I am using both a TImageEnView (for single page) and TImageEnMView (for multiple pages)
The issue is that using a Canon DR-C225, certain scan settings will produce an image that has 3 columns of the same page. The source document being scanned is a single page of text.
Most of the issues are when the 'Detect Automatically' options are used for Color Mode, Paper Size and DPI.
I have a table of the settings that do work, and what ones don't. I also realize that different scanners behave differently, which makes it difficult to debug things inside their proprietary scan code. Significantly better scan results have already been achieved by setting the TwainParams.AutoDeskew := false, but somehow I think I am still missing something.
Please let me know if you have some info on a property setting or method of dealing with this issue, we're trying to resolve this issue for our customers.
Thank you, Greg |
20 L A T E S T R E P L I E S (Newest First) |
Scott |
Posted - Dec 21 2016 : 18:18:29 Nigel, sorry I didn't notice the request here for the log file. I have attached it here. There are two copies, one before calling acquire and one after acquire, just in case. We are still having issues with this. The original client had issues with Canon and the CaptureOnTouch software that was installed with the Canon scanners. Now the same client bought Brother scanners which comes Control Center 4 software and we are having similar issues. We were just adjusting the settings in the Canon software to control the issue. We haven't been able to do that so far with the Brother software. Thanks for your help, I hope you can tell something from the logs.
attach/Scott/20161221181717_twainlog.zip 3.17 KB |
xequte |
Posted - Jun 28 2016 : 19:07:09 Hi Scott
Can you generate us a log so we can see what format the scanner used to send the image:
ImageEnMView.MIO.TwainParams.LogFile := 'D:\twainlog.txt';
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
xequte |
Posted - Jun 26 2016 : 01:09:04 Hi Scott
We are investigating this. I expect it is due to to an unexpected color depth in the acquired image.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
Scott |
Posted - Jun 24 2016 : 16:19:08 Bill, that would have been my thought as well but our software written in Delphi 7 using the ImageLib components works perfectly fine with the same driver. The issue we are seeing is with same Canon scanner and driver, and same Canon CaptureOnTouch software. The only change is our same software converted to Delphi XE6 with ImageEn components replacing the ImageLib components. |
w2m |
Posted - Jun 17 2016 : 13:51:18 The only problem with your approach is ImageEn may not be able to fix the problem if it is a driver problem... In that case you have no choice if you want to resolve it. As I understand twain is older than WIA which is why some vendors may not fix their old twain driver problems.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
Scott |
Posted - Jun 17 2016 : 11:39:59 Bill, when the drivers are installed for this scanner, two drivers install. One is called Canon DR-C130 TWAIN, the other is WIA-CANON DR-C130 USB. The one listed as WIA does actually work fine, it does not have the issues that the TWAIN driver has. However, ImageEn doesn't recognize the driver as WIA, it shows them both as TWAIN. This has been a point of confusion also while investigating this issue. Also, we have been telling our users to use TWAIN compliant scanners and to use the TWAIN drivers for years now, we are trying to avoid completely changing this now. Thanks. |
w2m |
Posted - Jun 17 2016 : 10:41:42 In the past I have found that WIA often works better than TWAIN. I assume you are using TWAIN, so try using WIA and see if the problem persists. ImageEn1.IO.SelectAcquireSource([ieaWIA])
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
Scott |
Posted - Jun 17 2016 : 09:59:37 Nigel, we are using 6.2.0. I need to make a correction on my last post. We can't confirm that this has happened with a different scanner brand yet other than Canon. As far as we can tell also, the Canon CaptureOnTouch software has to be installed so that the advanced setting Color Mode = "Detect Automatically" can be set. If that setting is not set in that software, we don't appear to have issues. I will note though that our users that are installing the Canon software from the installation CD are installing that software and "Detect Automatically" is the default setting so we are seeing the issue frequently. Thanks. |
xequte |
Posted - Jun 16 2016 : 18:41:56 Hi Scott
We'll investigate this. Can you confirm the ImageEn version you are using?
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
Scott |
Posted - Jun 16 2016 : 11:15:50 I am attaching an image from the ImageEn Multi demo. As you can see the second image scanned in has the same issue. The first image comes in fine, the second image shows as 3 columns. As I said before, the image will save this same way. And now we have a client with a Brother scanner reporting the same issue, so it doesn't appear to be limited to just the Canon software like we thought.
|
Scott |
Posted - Jun 15 2016 : 12:09:26 This is one of the images produced. This page was black and white, the setting in the canon software was set to Detect Automatically, and I tried to set the bit depth to 1.
attach/Scott/201661512911_ImageEnColumns.zip 13.1 KB |
Scott |
Posted - Jun 14 2016 : 18:48:51 Nigel, with this specific scanner, it is able to detect when a color page is being scanned in. The users have Canon software, CaptureOnTouch on their machines. This software is just to allow the user to interact with the scanner: set settings, scan docs, etc. There is an option in that software to set the “Color Mode” to several values “Detect Automatically”, “Black and White”, “24-bit color”, etc. When I set the value to black and white or 24-bit color, everything is fine. When I set it to detect automatically, it’s like the scanner wants to scan in 3 columns. When I set the bit depth to any value in the code, it displays the scanned image in 3 columns across the screen. When I leave the bit depth alone, it basically chops the image into 3 columns, only displaying the first. I can tell this because looking at the image I can easily tell that only one third of the page is displaying.
Ok, here is what I am doing in the code. I am using a TImageEnMView as a thumbnail view and a TImageEnVect to actually view the images as they are clicked in the thumbnail view. Before I scan I set the following TWainParams.
ImageEnMView.MIO.TwainParams.AutoScan := false;
ImageEnMView.MIO.TwainParams.PixelType.CurrentValue := 1;
//ImageEnMView.MIO.TwainParams.BitDepth.CurrentValue := StrToInt(cmbBitDepth.Text);
//ImageEnMView.MIO.TwainParams.Contrast.CurrentValue := 0;
//ImageEnMView.MIO.TwainParams.Brightness.CurrentValue := 0;
ImageEnMView.MIO.TwainParams.Threshold.CurrentValue := 128;
ImageEnMView.MIO.TwainParams.XResolution.CurrentValue := 150;
ImageEnMView.MIO.TwainParams.YResolution.CurrentValue := 150;
// ImageEnMView.MIO.TwainParams.XScaling.CurrentValue := StrToFloat(ebXScaling.Text);
// ImageEnMView.MIO.TwainParams.YScaling.CurrentValue := StrToFloat(ebYScaling.Text);
This is the code that does the actual scanning:
ImageEnMView.Clear;
ImageEnVect.Clear;
ImageEnMView.MIO.TwainParams.SelectedSource := cmbScanner.ItemIndex;
ImageEnMView.MIO.TwainParams.VisibleDialog := false;
ImageEnMView.MIO.NativePixelFormat := true;
if ImageEnMView.MIO.Acquire then begin
ImageEnMView.MIO.Params[0].TIFF_Compression := ioTIFF_G4FAX;
//ImageEnMView.MIO.Params[0].TIFF_Compression := ioTIFF_LZW;
ImageEnMView.MIO.Params[0].BitsPerSample := 1;
//ImageEnMView.MIO.Params[0].BitsPerSample := 8;
ImageEnMView.MIO.Params[0].SamplesPerPixel := 1;
ImageEnMView.MIO.DuplicateCompressionInfo;
NOTE: THIS LOOP BELOW WAS NOT IN MY ORIGINAL CODE WHERE I SAW THIS ISSUE, BUT IT DOES STILL HAPPEN WITH THE THE LOOP. I ADDED IT BECAUSE THE IMAGES WERE ALL COMING IN IN COLOR, EVEN WHERE I HAD THE BITDEPTH AND PIXELTYPES SET TO 1.
for iImageCount:=0 to ImageEnMView.ImageCount-1 do begin
ImageEnMView.SelectedImage := iImageCount;
ImageEnMView.Proc.ConvertToBW_FloydSteinberg;
end;
ImageEnMView.SelectImage(0);
ImageEnMViewImageSelect(self, 0);
if cbFit.Checked then
ImageEnVect.Fit;
end;
The two procedures below are what I use to manage the correct image showing from the thumbnail view to the ImageEnVect component:
procedure TfrmScanTest.ImageEnMViewImageSelect(Sender: TObject; idx: Integer);
begin
ScrollThumbnailView(idx);
end;
procedure TfrmScanTest.ScrollThumbnailView(PageIndex: integer);
begin
// Copy image
ImageEnMView.CopyToIEBitmap(PageIndex, ImageEnVect.IEBitmap );
// Copy annotations
ImageEnVect.RemoveAllObjects;
ImageEnMView.MIO.Params[PageIndex].ImagingAnnot.CopyToTImageEnVect(ImageEnVect);
ImageEnVect.Update;
end;
I got a server error 500 when trying to attach the image or a zip containing the image. But yes, it does save with the 3 columns exactly how it is displayed in the ImageEnVect component.
|
xequte |
Posted - Jun 09 2016 : 00:24:26 Hi Scott
The issue earlier was due to the user setting an incompatible color depth and TIFF compression.
Can you let me know what code you are using?
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
Scott |
Posted - Jun 07 2016 : 16:56:27 Was this issue ever solved? I am having the exact same problem with a Canon DR-C130. When the Color Mode property in the scanner's settings is set to "Detect Automatically", the image shows in 3 columns across the screen. This happens in all of the ImageEn demos that I have tried also. If you change the setting to "Black and White" or "24-bit Color", the image scans in fine. I assume there is some property or combination of properties in ImageEn that can force this setting to not be "Detect Automatically", but I have yet to find that setting(s). |
xequte |
Posted - Mar 14 2016 : 15:49:53 Hi
It looks like you are not setting the BitsPerSample and SamplesPerPixel which is required when changing TIFF compression.
For example:
ImageEnMView.MIO.Params[0].TIFF_Compression := ioTIFF_JPEG;
ImageEnMView.MIO.Params[0].BitsPerSample := 8;
ImageEnMView.MIO.Params[0].SamplesPerPixel := 3;
ImageEnMView.MIO.DuplicateCompressionInfo();
For monochrome ioTIFF_G4FAX you need:
ImageEnMView.MIO.Params[0].TIFF_Compression := ioTIFF_G4FAX;
ImageEnMView.MIO.Params[0].BitsPerSample := 1;
ImageEnMView.MIO.Params[0].SamplesPerPixel := 1;
ImageEnMView.MIO.DuplicateCompressionInfo();
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
CC_ImgDev |
Posted - Mar 07 2016 : 17:20:16 Yes that happens in some cases... the preview thumbnail looks good, but can sometimes have an issue when saved. |
xequte |
Posted - Mar 07 2016 : 17:02:33 Hi Greg
Sorry, are you saying that the image may look OK within the TImageEnMView but becomes odd at the point of saving?
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
CC_ImgDev |
Posted - Mar 07 2016 : 15:39:41 Thanks for your feedback Nigel,
Yeah, it's a tough situation to debug, not knowing what is happening inside the scanner, and a wide array of combinations that affect it's behavior.
We've spent a lot of time stepping through the code, and sometimes the image is distorted (multiple columns etc.) directly from the acquire call, other times the image looks good after the acquire stage, but has a problem when saved.
The code is broken down into distinct calls for each file type, calling the appropriate save type for .jpg, .tiff and .pdf files like this example, otherwise they pretty much follow the same code - it just behaves much differently for different scanner settings - especially the 'Automatically Detect' options.
If you see any obvious failings in this approach please let me know what you suggest to correct it...
procedure TMyForm.OnAcquireClose(Sender: TObject);
var
FileExt: string;
Msg: string;
begin
FileExt := UpperCase(ExtractFileExt(ScanFileName));
ScanPages := ImageEnMView.MIO.ParamsCount;
if ScanPages < 1 then exit;
// set compression after file is acquired
if ImageEnMView.MIO.Params[0] <> nil then
begin
if (UpperCase(FileExt) = '.PDF') then
begin
ImageEnMView.MIO.Params[0].PDF_Compression := ioPDF_JPEG;
ImageEnMView.MIO.DuplicateCompressionInfo;
end
else if IsTIFF_File(FileExt) then
begin
//ImageEnMView.MIO.Params[0].TIFF_Compression := ioTIFF_G4FAX;
ImageEnMView.MIO.Params[0].TIFF_Compression:=ioTIFF_JPEG;
ImageEnMView.MIO.DuplicateCompressionInfo;
ImageEnMView.RemoveBlankPages(0.0001, true, true); // to remove black pages
end;
end;
ImageEnMView.Proc.AutoCrop2; // try to remove any black borders
try
if (UpperCase(FileExt) = '.PDF') then
ImageEnMView.MIO.SaveToFilePDF(ScanFileName)
else if IsTIFF_File(FileExt) then
ImageEnMView.MIO.SaveToFileTIFF(ScanFileName);
except on e: exception do
begin
if ImageEnMView.MIO.TwainParams.LastError > 0 then
begin
Msg := format('Error code %d' + #13#10
+ '%s' + #13#10
+ '%s', [ImageEnMView.MIO.TwainParams.LastError,
ImageEnMView.MIO.TwainParams.LastErrorStr,
e.Message]);
MessageDlg(Msg,mtError,[mbOK],0);
end;
end;
end;
Thanks much, Greg
|
xequte |
Posted - Mar 05 2016 : 21:17:49 No worries.
These issues will be very difficult for us to debug if they only occur with that one scanner. Also, if the driver itself is just buggy or oddly incompatible then adding workarounds for it could adversely affect our support for other devices.
I recommend that you try stepping through the ImageEn code to see where it is failing and then we can decide what our options are.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
CC_ImgDev |
Posted - Mar 04 2016 : 16:39:18 Sorry! My forum newbie status is confirmed. here it is, thanks.
attach/CC_ImgDev/201634163811_T6317_IE.zip 91.48 KB |