Scaling Acquired Images |
Top Previous Next |
DTWAIN allows you to scale the image that is acquired. By scaling the image, you can resize the image in the horizontal and vertical directions. Scaling an image can be used to produce thumbnail images, or larger images than what was acquired.
To scale an image, the DTWAIN_SetAcquireImageScale function is called before acquiring the image. This function can also alternately be called when your application receives the DTWAIN_TN_TRANSFERREADY or DTWAIN_TN_PROCESSEDDIB notification.
When scaling an image, the image's area of acquisition is processed first (see Setting Image Retrieval Size), and then the image is scaled according to the arguments to DTWAIN_SetAcquireImageScale.
Note that scaling an image will only work when acquiring Device Independent Bitmaps (DIBs). If you are acquiring non-DIB data (your application has called DTWAIN_SetCompressionType to any value except DTWAIN_CP_NONE, and your application calls DTWAIN_AcquireBuffered), then DTWAIN does not attempt to scale the image.
To produce thumbnail images, it is recommended to call DTWAIN_SetAcquireImageScale( Source, 0.1, 0.1 ), where Source is the DTWAIN_SOURCE, and 0.1 is a 10% scaling in the x and y directions.
Example:
Acquire one page to BMP file called "Temp.bmp". Scale the image to 10% of the original size:
DTWAIN_SOURCE Source;
// Assume Source has been selected and opened //...
DTWAIN_SetAcquireImageScale( Source, 0.1, 0.1 );
DTWAIN_AcquireFile( Source, "Test.bmp", DTWAIN_BMP, DTWAIN_USENATIVE, DTWAIN_PT_DEFAULT, 1, TRUE, TRUE, NULL);
|