Home › Forums › TWAIN Classic › scan in .jpg
- This topic has 7 replies, 2 voices, and was last updated 16 years, 10 months ago by gabe.
- AuthorPosts
Hi,
I have already create a program which scan a document and save it into a .bmp file. Now, I would like to save this file into a .jpg file. To do it I tryed to replace the DAT_IMAGENATIVEXFER by DAT_JPEGCOMPRESSION in the aquisition command. But it doesn’t work? here is the parameters used : DG_IMAGE,DAT_JPEGCOMPRESSION,MSG_GET; Anybody can help me ??
You’re looking for icap_imagefileformat.
I typically handle this in 2 steps. I’ll first check if the device in question seems to support the output format that I’m looking for using icap_imagefileformat/get. If the format that I want the output in is supported by the device, I get set it with icap_ImageFileFormat/Set. If the format that I’m looking for isn’t supported by the device (it happens), then I play outside of twain spec with the installed encoders on the machine and convert the image by hand – ref msdn.
I use icap_ImageFileFormat in my program but how could I verify that the parameter had been corrctly inserted?
Is there other operation that i could do to obtain a .jpg file??
1) Check that source supports jpg with ImageFileFormat.Get.
2) Set to jpg is it isn’t already set with ImageFileFormat.Set.
3) Double check that #2 is right with ImageFileFormat.Get.
4) Execute Control.SetupFileXfer.Set and pass in a twSetupFileXfer structure making sure you set the .Format and .Filename fields appropriately.It shouldn’t be much trickier than this. If you read .net code look at the method TransferPicturesAsFile in the ctwain.vb file in my source over at codeplex/openTwain.
If you have more questions, just ask.
.
thanks for your help Gabe! I have another question. I have hide the user interface and i would like to set the scan resolution to 300 dpi. I have to use ICAP_XRESOLUTION and ICAP_YRESOLUTION but it doesn’t work and I don’t understand why. Somebody has an idea? a piece of source code in C/C++??
the toolkit has an aweful lot of c++ code in it if you havent been thru it already:
http://twain.org/devfiles/twainkit.exethe problems I’d seen/had with setting resolution in the past we mostly due to the fix32 structure that you use. Take a look thru how it is accomplished in the toolkit and if you’re still having trouble open a new thread with the issue.
cheers.
it works now! thanks a lot !!! 😉
what was the issue (just curious)
.
- AuthorPosts