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
 WIA scaning and image size

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
gorchi Posted - Nov 06 2026 : 05:24:03
Hi,
I am currently using IE 15.4.0 beta and I have interesting problem. I set up scanner to scan whole area using 300 dpi but the image I get is with 150 dpi. Related to the topic "Scanner hold up after scanning", I am writing to a log and here is an exceprt:
06.11.2026 11:58:05  Device selected: CanoScan 9000F Mark II||0||WIA||SCN
06.11.2026 11:58:05  According to AcquireParams.SelectedSource.API it is WIA
06.11.2026 11:58:05  Scanning will be performed using WIA 1
06.11.2026 11:58:05  Requested scan in full color
06.11.2026 11:58:05  Writing params in MIO.AcquireParams
06.11.2026 11:58:05  Basic params: 300 dpi, color depth: Barvno (24-bit), orientation: Pokon#269;no, rotation: 0
06.11.2026 11:58:05  Writing params in MIO.AcquireParams.. done.
06.11.2026 11:58:05  Requesting scan start from a device (driver)
06.11.2026 11:58:05  scanning document,     62 ms    0%
06.11.2026 11:58:11  scanning document,   6343 ms  100%
06.11.2026 11:58:12  Scan complete - On AcquireBitmap,   6593 ms  100%, bitmap width: 1275, height: 1753, dpi X: 150, dpi Y: 150

The last line is from ImageEnMView.OnAcquireBitmap. Why the received image has 150dpi? There is even more fun to this. If I set scanner to 150 dpi or 200 dpi, the last line is the same; same bitmap size, same dpi.

Before scanning I set the params like this:
(setting the scanner in the extra window, result is index in TStringList named SeznamNapravRaw
  sNapravaRaw := SeznamNapravRaw.Strings[AIndexNaprave];
  iemvSlike.MIO.AcquireParams.SetSourceByStr(sNapravaRaw);
  xDevice := StrToAcquireSource(sNapravaRaw);
  if xDevice.API = ieaTwain then
  begin
    iemvSlike.MIO.TwainParams.GetFromScanner;
    glScannerSkup.SkenerInfo.OpticalX := Round(iemvSlike.MIO.AcquireParams.AttachedTwainParams.XResolution.RangeMax);
    glScannerSkup.SkenerInfo.OpticalY := Round(iemvSlike.MIO.AcquireParams.AttachedTwainParams.YResolution.RangeMax);
 
    glScannerSkup.SkenerInfo.MaxSizeX := iemvSlike.MIO.AcquireParams.AttachedTwainParams.PhysicalWidth;
    glScannerSkup.SkenerInfo.MaxSizeY := iemvSlike.MIO.AcquireParams.AttachedTwainParams.PhysicalHeight;
  end;

 if xDevice.API = ieaWIA then
 begin
   iTemp := 0;
   sTemp := iemvSlike.MIO.WIAParams.GetDeviceProperty( WIA_DPS_OPTICAL_XRES );
   TryStrToInt(sTemp, iTemp);
   glScannerSkup.SkenerInfo.OpticalX := iTemp;
   iTemp := 0;
   sTemp := iemvSlike.MIO.WIAParams.GetDeviceProperty( WIA_DPS_OPTICAL_YRES );
   TryStrToInt(sTemp, iTemp);
   glScannerSkup.SkenerInfo.OpticalY := iTemp;
   
   iTemp := 8500; //width of "letter" - full size scan
   sTemp := iemvSlike.MIO.WIAParams.GetDeviceProperty( WIA_DPS_HORIZONTAL_BED_SIZE);
   TryStrToInt(sTemp, iTemp);
   glScannerSkup.SkenerInfo.MaxSizeX := iTemp/1000;

   iTemp := 11690; //height of "letter" - full size scan
   sTemp := iemvSlike.MIO.WIAParams.GetDeviceProperty( WIA_DPS_VERTICAL_BED_SIZE);
   TryStrToInt(sTemp, iTemp);
   glScannerSkup.SkenerInfo.MaxSizeY := iTemp/1000;
 end;

..

with iemvSlike.MIO do //=imageenmview.mio
  begin
    AcquireParams.XScaling            := 1;
    AcquireParams.YScaling            := 1;
    AcquireParams.XResolution         := glNastavitveXML.Nastavitve.Skener.Locljivost;
    AcquireParams.YResolution         := glNastavitveXML.Nastavitve.Skener.Locljivost;
    iemvSlike.MIO.AcquireParams.AcquireFrameEnabled := True;
    AcquireParams.AcquireFrameLeft    := 0.0;
    AcquireParams.AcquireFrameTop     := 0.0;
    AcquireParams.AcquireFrameRight   := glScannerSkup.SkenerInfo.MaxSizeX;
    AcquireParams.AcquireFrameBottom  := glScannerSkup.SkenerInfo.MaxSizeY;
    if AcquireParams.SelectedSourceApi = ieaTwain then
      begin
        NativePixelFormat := True;
      end
    else if AcquireParams.SelectedSourceApi = ieaWIA then
      begin
        //WIAParams.TransferFormat := ietfJpeg;
        WIAParams.TransferFormat := ietfBitmap;
        WiaParams.SetItemProperty(WIA_IPS_XRES, glNastavitveXML.Nastavitve.Skener.Locljivost);
        WiaParams.SetItemProperty(WIA_IPS_YRES, glNastavitveXML.Nastavitve.Skener.Locljivost);
      end;
    AcquireParams.PixelType           := TIEAcquirePixelType( glNastavitveXML.Nastavitve.Skener.BarvnaGlobina );
    AcquireParams.Orientation         := DobiOrientacijo;
    AcquireParams.Rotation            := DobiRotacijo;

    for i := 0 to Length(Acquire_Source)-1 do
    begin
      if i = 1 then
        xSrc := tsrcFeeder
      else if i = 2 then
        xSrc := tsrcDuplexer
      else
        xSrc := tsrcFlat;
      if SameText(Acquire_Source[xSrc], glNastavitveXML.Nastavitve.Skener.VirDokumentov) then
      begin
        if (AcquireParams.FeederEnabled) and ( xSrc = tsrcFeeder) then
          AcquireParams.AutoFeed := AcquireParams.FeederLoaded;
        if (AcquireParams.DuplexSupported) and (xSrc = tsrcDuplexer) then
          AcquireParams.DuplexEnabled := True;
        Break;
      end;
    end;

    AcquireParams.VisibleDialog := glNastavitveXML.Nastavitve.Skener.PokaziDialog;

...
    iemvSlike.MIO.Acquire();


TWAIN works perfectly, the DPI is correct as well as the picture size, which for 300 dpi is 2550 x 3705 pixels. Any ideas?
Best regards,
Goran
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 13 2026 : 15:31:57
Hi Goran

No, it is fixed in the upcoming v15.5.5. You can email me for the beta if you like.

Nigel
Xequte Software
www.imageen.com
gorchi Posted - Nov 12 2026 : 17:05:26
Hi Nigel,

thank You for the explanation, I solved this using the WIA params for WIA and with universal AcquireParams for TWAIN after whole day investigating the problem. After that I read Your answer :) And yes, using the driver dialog it works as expected. I believe in 15.5.0 is fixed, right?

Thank You and best regards,
Goran
xequte Posted - Nov 09 2026 : 13:55:38
Hi Goran

Thanks for the detailed log. The problem is the call to AcquireParams.PixelType. For WIA, this sets the scan “intent” (WIA_IPS_CUR_INTENT), and many drivers respond by resetting the resolution (typically to 150 dpi) and the scan area to their defaults. Because your code sets PixelType after the resolution and acquire frame, those settings get lost.

Workaround for 15.4.0: set PixelType before XResolution/YResolution and the AcquireFrame properties (you can then remove the WiaParams.SetItemProperty(WIA_IPS_XRES/YRES) calls). This is fixed in the next beta, where the resolution and frame are kept when PixelType is set.

Also, if VisibleDialog is True, the resolution comes from the WIA dialog (its default is usually 150 dpi), not from your code.

Nigel
Xequte Software
www.imageen.com