Home › Forums › TWAIN Classic › Scanned images have same size in file transfer mode
- This topic has 5 replies, 6 voices, and was last updated 10 years, 3 months ago by Foximage.
- AuthorPosts
Hi,
I have developing scanner application in C++. Currently I am able to scanning the documents and get the images in file transfer mode. But all the scanned documents have same size even though the content of the documents are different.FileFormat:TWFF_TIFF
Pixel flavout: TWPF_CHOCOLATE
Xresoultion:75
Yresoultion:75
ICAP_UNITS: TWUN_INCHES
ICAP_PIXELTYPE: TWPT_GRAY
ICAP_BRIGHTNESS:0
ICAP_CONTRAST:0
ICAP_BITDEPTH: 8Every time scanned image size as 327kb. What I did wrong or I missed anything else? Please assist me. One more question how can I set JPEG_Compression. Is file transfer mode supports JPEG_compression?
Thanks
KannanHi Kannan…
An application sets ICAP_COMPRESSION to TWCP_JPEG to request JPEG compression. The best value for a file transfer is then TWFF_JFIF, which should result in a .jpg file.
While it’s possible to wrap JPEG inside of TIFF, not all TIFF viewers will be able to display it.
— Mark
Hi Kannan – yes, probably your scanner/driver is writing the TIFF file with no compression, so if each scan is the same number of pixels, the file size will also be the same.
It is fairly common that grayscale and color scans are written to TIFF without any compression, because the only compression that works well on these scans is JPEG, and there are compatibility problems with using JPEG compression in TIFF files. (Briefly: JPEG compression was badly standardized in TIFF 6.0, that was repudiated and replaced with a superior but incompatible version in TIFF Technical Note #2 (TTN2) – so there are two incompatible ways to use JPEG compression in a TIFF file: ‘Old Style’ or ‘Wang’ JPEG and ‘New Style’ or ‘TTN2’ JPEG. Some software reads one, some reads the other, some reads both but only writes one, etc.)
You can try selecting TIFF file format by setting ICAP_IMAGEFILEFORMAT to TWFF_TIFF, then setting the compression algorithm to JPEG by setting ICAP_COMPRESSION to TWCP_JPEG. It is up to your scanner’s TWAIN driver to decide whether it supports this. And you won’t really know which flavor of JPEG-in-TIFF you get until you examine the resulting TIFF file.
I recommend AsTiffTagViewer from Aware Systems, for viewing the metadata of TIFF files:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.htmlThe following code shows how to control acquired image position and size:
this.device.Units = UnitType.Inches;
if (this.device.Units != UnitType.Inches) return;
this.device.Frame = new System.Drawing.RectangleF(0, 0, 8.5, 11);Does this work ?I found that from Twain Scanning in C#.NETby google.
Hi, Wallism.
I am also testing with the related Twain Scanners and learning to build TIFF scanner with the help of some manual tools which can be customized by users according to our own favors to help view and scan tiff files these days. You can also google it and select one whose way of processing is simple and fast to help you with the related work. Remember to check its free trial package first if possible. I hope you success. Good luck.Best regards,
PeterImplment a mature TWAIN scanning add-on which is developed to capture digital images with a TWAIN (32 and 64 bit) device driver, including digital camera, scanners, and more. During the scanning, it is very easy to detect & define image compression modes, frame sizes, resolutions, etc.
- AuthorPosts