AcquiredImage.IsBlank(Single) alters image compression

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
veenasiva
Posts: 4
Joined: Wed Mar 06, 2019 4:01 am

AcquiredImage.IsBlank(Single) alters image compression

Post by veenasiva »

Hi,

I am using AcquiredImage.IsBlank(Single) to determine if a scanned image is blank.I have noticed that the compression of the image changes to None once this code is executed.
I set device properties as below

Code: Select all

  device.TransferMode = TransferMode.Memory;
  device.ShowUI = false;
  device.ShowIndicators = false;
  device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches;
  device.DisableAfterAcquire = false;
  // enable duplex
  device.DocumentFeeder.DuplexEnabled = true;

  device.PixelType = PixelType.BW;
  device.ImageCompression = TwainImageCompression.Group4;
  //resolution
  device.SetResolution(300, 300);
  device.Acquire();
In debug mode i can see that the image compression is Group4, but immediately after execution of code in if statement below(this code is inside device_imageAcquired) image compression changes to None.

Code: Select all

  if (e.Image.IsBlank(0.01f))
  {
  }
I need to know how to retain the compression set initially.

Veena
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: AcquiredImage.IsBlank(Single) alters image compression

Post by Alex »

Hello Veena,

SDK "unpacks" image data before processing an image.

Why do you need to retain initial compression after image processing? Please let me know all actions, which you do with scanned image.

Best regards, Alexander
veenasiva
Posts: 4
Joined: Wed Mar 06, 2019 4:01 am

Re: AcquiredImage.IsBlank(Single) alters image compression

Post by veenasiva »

Hi Alex,

Thanks, We are not processing the image after scan.Below are the steps that we do.
1. Open device manager
2. Open device
3. set device properties
4. Scan/Acquire Image
5. During Image Acquisition check if image is blank
6. If not blank save image to disk.

Without compression the image size differs(almost doubles/triples when scanned in color) as compared to compressed image size.

Thanks
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: AcquiredImage.IsBlank(Single) alters image compression

Post by Alex »

Hi Veena,

Thank you for information. In next minor release, which will be available next week, we will add the ability to disable the image data decompressing during image processing.

Without compression the image size differs(almost doubles/triples when scanned in color) as compared to compressed image size.
In most cases TWAIN drivers compress color images using JPEG compression. For getting better image file size you also need to use JPEG compression.

Best regards, Alexander
veenasiva
Posts: 4
Joined: Wed Mar 06, 2019 4:01 am

Re: AcquiredImage.IsBlank(Single) alters image compression

Post by veenasiva »

Thank you,yes i am using jpeg for color and group4 for B&W.
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: AcquiredImage.IsBlank(Single) alters image compression

Post by Alex »

Hi Veena,

In version 10.3.5.1 we have added the AcquiredImage.RetainDataCompression property, which allows to disable the image data uncompression after image processing. Please use version 10.3.5.1 and let me know if you will have any question or problem.

Best regards, Alexander
Post Reply