Home › Forums › TWAIN Classic › Setting Compression for File Transfers
- This topic has 1 reply, 2 voices, and was last updated 16 years ago by gabe.
- AuthorPosts
Hi,
I have written my TWAIN code to support file transfers and it is all working fine.
I’ve figured out how to set the compression used for saving TIFF files using the ICAP_COMPRESSION capability. So when scanning colour, I am using JPEG compression and for B&W I am using G4 compression.
My question is that the scanner I am using (Fujitsu fi-5900C) supports automatic colour detection via TWAIN. I can change the format of the file when requesting the file from the scanner, but I can’t change the compression.
So at the moment, I am getting the image info and if it is black and white, requesting a TIFF file and if it is colour, requesting a JPEG. This works fine and if I scan a batch of images this way with auto colour detect on, I get a series of files that are either TIFFs or JPEGs depending on their bit depth.
However, the TIFF files are uncompressed TIFFs. I have tried changing the compression before getting the image, but it is not valid during this stage (6). I have tried setting the image format to TIFF and compression to Group 4 duting stage 4, but then as soon as I switch to JPEG and back to TIFF, it is reset to no compression.
Is there any way around this? How should I be doing this?
@twain spec – pg 435 wrote:
Note for File transfers:
Since only certain file formats support compression, this capability must be negotiated after
setting the desired file format with ICAP_IMAGEFILEFORMAT.Try setting ICAP_IMAGEFILEFORMAT Then the compression not the other way around.
And the bit with trying to set the cap when twstate=6, capabilities can only be negotiated in State 4 (unless special arrangements are made
using the CAP_EXTENDEDCAPS capability). Search the spec for CAP_EXTENDEDCAPS..
- AuthorPosts