TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Scanning directly into a file

Forums › TWAIN Classic › Scanning directly into a file

  • This topic has 19 replies, 3 voices, and was last updated 12 years, 12 months ago by ZiggyShort.
Viewing 5 posts - 16 through 20 (of 20 total)
← 1 2
  • Author
    Posts
  • January 22, 2008 at 5:24 pm #24294 Reply
    ZiggyShort
    Participant
    • Topics - 4
    • Replies - 16
    • Total Posts - 20

    The reason the DSM_Entry call to SetupFileXfer was failing was because the file format I was trying to create was TIFF. It seems you can have any flavour you want as long as its BMP. I changed the format to BMP, then added a call

    rc = DSM_Entry(appid, srcds, TwDG.Image, TwDAT.ImageFileXfer, TwMSG.Get, null);

    And the file was created. The resolution of the file is as I want. I may need to convert the file from bmp to jpeg or tiff, but that is pretty straightforward. Thanks to gabe and kaij for your help.

    January 23, 2008 at 2:42 pm #24295 Reply
    ZiggyShort
    Participant
    • Topics - 4
    • Replies - 16
    • Total Posts - 20

    If anyone is interested, file conversion in C# from bmp to almost anything is trivial, it turns out:

    Bitmap bm = new Bitmap(@”c:pathfile.bmp”);
    bm.Save(@”c:pathfile.jpg”, ImageFormat.Jpeg);
    bm.Save(@”c:pathfile.tif”, ImageFormat.Tiff);
    bm.Save(@”c:pathfile.gif”, ImageFormat.Gif);
    bm.Save(@”c:pathfile.png”, ImageFormat.Png);

    And yes, the dpi resolution is preserved.

    January 23, 2008 at 6:33 pm #24296 Reply
    ZiggyShort
    Participant
    • Topics - 4
    • Replies - 16
    • Total Posts - 20

    Altough: I am surprised I cannot save directly as a tiff: from Canon’s own software, it saves to files of different formats including tiff… Or are there other settings to be taken into account when saving to tiff?

    January 23, 2008 at 7:22 pm #24297 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    I dunno, tiif generation in the .net framework seemed similar to any of the other formats native to the machine (to me). There is a little hand waving if you want to create multi frame files but I handle Bmp, Gif, Jpeg, Png & Tiff all the same.
    To be fair .Net’s default Gif support is,.. what’s the kind work, lousy? And I don’t go out of my way to provide the quality encoder parameter related to jpg encoding- the default (I think it’s 85%) is sufficient.
    The code is in the BitmapManip project and the main method to trace (outside of the ctor) is ‘toFile’. I’d post it here but it isn’t really related to twain and I didn’t do very much more than peice toether a couple of code snippets from codeproject to get it working. If you have a question about it send me an email.

    .

    January 24, 2008 at 1:39 pm #24298 Reply
    ZiggyShort
    Participant
    • Topics - 4
    • Replies - 16
    • Total Posts - 20

    This is, it turns out, to be a limitation of my scanner.

    I downloaded Twister from http://www.dosadi.com/twister.htm
    and it analyses your scanner. Turns out, mine only supports BMP file downloads. So there was nothing dodgy about the code. The fact that the scanner provider allows scanning to different formats directly, seems to suggest they are bypassing Twain to do this. At least it’s not .NET/the code/me….

  • Author
    Posts
Viewing 5 posts - 16 through 20 (of 20 total)
← 1 2
Reply To: Scanning directly into a file
Your information:




Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.