Home › Forums › TWAIN Classic › How to set compression type?
- This topic has 3 replies, 3 voices, and was last updated 14 years ago by june5.
- AuthorPosts
Hello!
I use scanner (Canon DR-6050C) and faced next problem:
scanner scans in 24-bit colour mode first 10-15 pages quickly like it should, but after that, scanner begins to scan much slower and after scanning it sends image data rather long.After different experiments in different scanning programs and debugging under Twacker, I have found that main point is in compression of the image.
If I set driver for jpeg compression through memory transfer mode everything is right. I found it using PixEdit by TechSoft scanning program. Now I need to do it in my program.But I don’t understand how to do it. What caps should I set and in what order?
Looking up for this question in TWAIN Specification I mentioned next main words: ICAP_IMAGEFILEFORMAT, ICAP_COMPRESSION, ICAP_JPEGQUALITY, DAT_JPEGCOMPRESSION, TW_JPEGCOMPRESSION,
but i still don’t understand how and in what order use it, even after looking in CapOrder scheme.Thank you,
MichaelNot sure about the Canon scanner directly. but in general I would do it this way.
Set the caps in this order.
XFERMECH (file or memory)If scanning without UI set PixelType, BitDepth, ( if using file – ImageFileformat ), Compression, (if jpeg – JPEGQuality ).
If scanning with UI then set the compression of all possible PixelType and BitDepth combinations. Example:
BW, 1bit – G4
Gray, 8bit – JPEG
RGB, 24bit – JPEGMake sure you do a get ImageInfo for each transfer to know what compression is being used. Memory transfer with compression is a bit more complicated. Width X Height X BitDepth != memory required. If AutomaticBorderDection is turned on you might not even know Width and Height until the transfer is complete.
Jim Watters
Thank you for answer.
I tried to do things the way you’ve written (in comment there are parameters that I set in each function). But I get some strange picture – all black with color noise in the top. And the image is still big
SetPixelType( TWPT_RGB );
// cap ICAP_PIXELTYPE, cap type TWTY_UINT16, CallDSMEntry with params: DG_CONTROL, DAT_CAPABILITY, MSG_SET
SetBitDepth(24);
// cap ICAP_BITDEPTH, cap type TWTY_UINT16, CallDSMEntry with params: DG_CONTROL, DAT_CAPABILITY, MSG_SET
SetCompressionType( TWCP_JPEG );
// cap ICAP_COMPRESSION, cap type TWTY_UINT16, CallDSMEntry with params: DG_CONTROL, DAT_CAPABILITY, MSG_SET
SetJpegQuality(TWJQ_LOW);
// cap ICAP_JPEGQUALITY, cap type TWTY_INT16, CallDSMEntry with params: DG_CONTROL, DAT_CAPABILITY, MSG_SETUsing Twacker, I found that scanner doesn’t support ICAP_COMPRESSION (I found how to find it by that instruction http://support.leadtools.com/CS/forums/3781/ShowPost.aspx , isn’t it wrong?).
If that true, then there should be another way (another order or another caps), because another program still works with this scanner (PixEdit)Thank you,
Michaeldid you set ICAP_XFERMECH?
- AuthorPosts