ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 AllAcquire.exe Wia only Scan Gray

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Ralf Posted - Apr 03 2017 : 11:04:09
Hi Nigel,
i tried to scan per WIA and set the color to Full Color. The Result is, that the scan is only in Gray when i doesn't use the Acquisition Dialog. When i use the dialog the scan is in Color.
Have you any idear?
Thanks
Ralf
12   L A T E S T    R E P L I E S    (Newest First)
Ralf Posted - May 03 2017 : 02:17:17
Hi Nigel,

thanks for your Feedback. The Quality using WIA_INTENT_IMAGE_TYPE_TEXT is not so good as using .._TYPE_GRAYSCALE. The size of the resulting image using Grayscale is much bigger.
The Size of ...TYPE_Text is nearly the same as scanning Black and White over Twain.
We will see what we use for scanning.

Ralf
xequte Posted - May 02 2017 : 19:47:02
Hi Ralf

According to the Microsoft documentation, WIA_INTENT_IMAGE_TYPE_TEXT is intended only when text is being scanned, so using it in a non-standard way (to denote monochrome) may cause inconsistent results across devices/drivers.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Ralf Posted - May 02 2017 : 02:15:52
Hi Nigel,

i tried your changes. Is there a reason why you also use WIA_Intent_Image_Type Grayscale by black and white and not for example WIA_INTENT_IMAGE_TYPE_Text.

When i scan a A4 Testpage with Twain Black and White the page has 22 kb.

When i do the same with WIA

Black and White WIA_INTENT_IMAGE_TYPE_Text 17 kb
Black and White WIA_INTENT_IMAGE_TYPE_GRAYSCALE 137 kb
Gray WIA_INTENT_IMAGE_TYPE_GRAYSCALE 210 kb

The quality of Twain Black and White is better then the Quality of WIA (as WIA_INTENT_IMAGE_TYPE_Text).

Maybe I can get a better result if i have a look on WIA_DATA_Threshold.

Ralf
xequte Posted - May 01 2017 : 17:29:29
Hi Ralf

So does it work if you change iexAcquire.pas as follows:

procedure TIEAcquireParams.SetPixelType(v : TIEAcquirePixelType);
var
  iBitsPerChannel: Integer;
begin
  case SelectedSourceApi of
    ieaTwain  : begin
                  iBitsPerChannel := -1;
                  case v of
                    ieapMonochrome    : begin
                                          fTwainParams.PixelType.CurrentValue := Twain_PixelType_BW;
                                        end;
                    ieap8BitGrayScale : begin
                                          fTwainParams.PixelType.CurrentValue := Twain_PixelType_Grayscale;
                                          iBitsPerChannel  := 8;
                                        end;
                    ieap16BitGrayScale : begin
                                          fTwainParams.PixelType.CurrentValue := Twain_PixelType_Grayscale;
                                          iBitsPerChannel  := 16;
                                        end;
                    ieapFullColor     : begin
                                          fTwainParams.PixelType.CurrentValue := Twain_PixelType_FullRGB;
                                          // Note: Some manufaturers incorrectly treat full color images as BitDepth of 24
                                          if ScannerTreatsBitDepthAsPerChannel then
                                            iBitsPerChannel  := 8
                                          else
                                            iBitsPerChannel  := 24;
                                        end;
                    ieapFullColor16   : begin
                                          fTwainParams.PixelType.CurrentValue := Twain_PixelType_FullRGB;
                                          if ScannerTreatsBitDepthAsPerChannel then
                                            iBitsPerChannel  := 16
                                          else
                                            iBitsPerChannel  := 48;
                                        end;
                    ieapOther         : begin { Ignore } end;
                  end;

                  if ( iBitsPerChannel > -1 ) and
                     ( fTwainParams.BitDepth.IndexOf( iBitsPerChannel ) >= 0 ) then
                    fTwainParams.BitDepth.CurrentValue := iBitsPerChannel;
                end;
    ieaWIA    : case v of
                  ieapMonochrome    : begin
                                        fWiaParams.SetItemProperty(WIA_IPA_BITS_PER_CHANNEL, 1);
                                        fWiaParams.SetItemProperty(WIA_IPA_CHANNELS_PER_PIXEL, 1);
                                        fWiaParams.SetItemProperty(WIA_IPS_CUR_INTENT, WIA_INTENT_IMAGE_TYPE_GRAYSCALE);
                                      end;
                  ieap8BitGrayScale : begin
                                        fWiaParams.SetItemProperty(WIA_IPA_BITS_PER_CHANNEL, 8);
                                        fWiaParams.SetItemProperty(WIA_IPA_CHANNELS_PER_PIXEL, 1);
                                        fWiaParams.SetItemProperty(WIA_IPS_CUR_INTENT, WIA_INTENT_IMAGE_TYPE_GRAYSCALE);
                                      end;
                  ieap16BitGrayScale : begin
                                        fWiaParams.SetItemProperty(WIA_IPA_BITS_PER_CHANNEL, 16);
                                        fWiaParams.SetItemProperty(WIA_IPA_CHANNELS_PER_PIXEL, 1);
                                        fWiaParams.SetItemProperty(WIA_IPS_CUR_INTENT, WIA_INTENT_IMAGE_TYPE_GRAYSCALE);
                                      end;
                  ieapFullColor     : begin
                                        fWiaParams.SetItemProperty(WIA_IPA_BITS_PER_CHANNEL, 8);
                                        fWiaParams.SetItemProperty(WIA_IPA_CHANNELS_PER_PIXEL, 3);
                                        fWiaParams.SetItemProperty(WIA_IPS_CUR_INTENT, WIA_INTENT_IMAGE_TYPE_COLOR);
                                      end;
                  ieapFullColor16   : begin
                                        fWiaParams.SetItemProperty(WIA_IPA_BITS_PER_CHANNEL, 16);
                                        fWiaParams.SetItemProperty(WIA_IPA_CHANNELS_PER_PIXEL, 3);
                                        fWiaParams.SetItemProperty(WIA_IPS_CUR_INTENT, WIA_INTENT_IMAGE_TYPE_COLOR);
                                      end;
                  ieapOther         : begin { Ignore } end;
                end;
    { ieaDCIM : N/A }
  end;
end;



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Ralf Posted - May 01 2017 : 11:13:35
Hi Nigel,

setting the Color this way work:
case color of
1: Val:=WIA_INTENT_IMAGE_TYPE_GRAYSCALE;{Grau}
2: Val:=WIA_INTENT_IMAGE_TYPE_COLOR; {Farbe}
else Val:=WIA_INTENT_IMAGE_TYPE_Text; {S/W}
end;
wiaParams.SetItemProperty(WIA_IPS_Cur_Intent, Val);

You should implement that way for setting the Color of the Scan in your Demo.

Best Regards

Ralf
xequte Posted - Apr 30 2017 : 18:48:38
Hi Ralf

Sorry, are you saying it fails when using the Acquire demo?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Ralf Posted - Apr 05 2017 : 03:38:40
Hi Nigel,
i'm at the moment looking in your source code to find what is different to my code.
By looking inside the AllAcqure Demo i found, that you save the new Properties befor you do the Acquire (inside the btnAcquire). In the "Save Parameters" Button you do also, after the saving, a "UpdateControlStatus".
That is the reason why i didn't see, that the changing of Color didn't work and it was set back to the old value. Maybe you implement in your demo for the Acquire Button also an Update.
Best Regards
Ralf
Ralf Posted - Apr 05 2017 : 02:25:28
Hi Nigel,
i tried only setting the first parameter

case color of
1: Val:=WIA_INTENT_IMAGE_TYPE_GRAYSCALE;{Grau}
2: Val:=WIA_INTENT_IMAGE_TYPE_COLOR; {Farbe}
else Val:=WIA_INTENT_IMAGE_TYPE_Text; {S/W}
end;
wiaParams.SetItemProperty(WIA_IPS_Cur_Intent, Val);

and the setting of the color works.

Witch more information to the used scanner do you want to know?
Regards
Ralf
Ralf Posted - Apr 05 2017 : 00:34:47
Hi Nigel,
at the moment i didn't know any scanner your version did work.
We tested with Brother ADS 2400N, Fujitsu fi-6110, OKI 873.
I can test later on in office in about 2 houers it we need both or for example the first is enough to get the correct result.
Regards
Ralf
xequte Posted - Apr 04 2017 : 16:47:16
Hi Ralf

Do you need to set both of these properties?

What is the make and model of the scanner?


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Ralf Posted - Apr 04 2017 : 05:27:52
Hi Nigel,
using
case color of
1: Val:=WIA_INTENT_IMAGE_TYPE_GRAYSCALE;{Grau}
2: Val:=WIA_INTENT_IMAGE_TYPE_COLOR; {Farbe}
else Val:=WIA_INTENT_IMAGE_TYPE_Text; {S/W}
end;
wiaParams.SetItemProperty(WIA_IPS_Cur_Intent, Val);

case color of
1: Val:=WIA_DATA_GRAYSCALE;{Grau}
2: Val:=WIA_DATA_COLOR; {Farbe}
else Val:=WIA_DATA_THRESHOLD;{S/W}
end;
wiaParams.SetItemProperty(WIA_IPA_DATATYPE, Val);

can set the Color!

Ralf Posted - Apr 04 2017 : 04:46:50
Hi Nigel,
i made a few more test's Setting
AcquireParams.PixelType:= TIEAcquirePixelType( cmbColors.ItemIndex );
doesn't change the PixelType of the Scanner. Only the Acquisition Dialog can change the Color.
Ralf