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

Capabilitie Trouble when 16 Bit Grayscale Tiff Scanning

Forums › TWAIN Classic › Capabilitie Trouble when 16 Bit Grayscale Tiff Scanning

  • This topic has 4 replies, 5 voices, and was last updated 6 years, 12 months ago by peterlee.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • February 21, 2012 at 7:13 pm #22732 Reply
    babboleo
    Participant
    • Topics - 1
    • Replies - 0
    • Total Posts - 1

    HY!!!
    😥
    my question:
    I have to create an application that scans a document in 16-bit gray scale and saved in TIFF format, uncompressed 600 dpi. Of course I must not use the Epson interface.
    With the Epson interface there are no problems but when I try to do the same thing programmatically, I can not set the capabilities in the right way and I always get an error. Using C # visual studio 2010. Is there any good Samaritan who can help me?
    The steps are:
    1) Select Source (not required)
    2) Scan the document in A4 format such as TIFF 16-bit grayscale(without Espon UI)
    3) Save to file, or manage it as an array in memory.

    … Before I committed suicide. Thank you very much and please excuse the language!

    March 20, 2012 at 11:54 am #25539 Reply
    Kaij
    Participant
    • Topics - 9
    • Replies - 132
    • Total Posts - 141

    Please make sure that you scan in buffered memory mode and not in native mode which can not support 16 bit.

    Best regards,
    Kaij
    http://www.jse.de

    March 21, 2012 at 6:15 am #25540 Reply
    Adam
    Participant
    • Topics - 0
    • Replies - 43
    • Total Posts - 43

    What error message did you get when setting through capabilities? Also, are you using a third-party tool to do the scanning or program from scratch based on the twain specification? If the latter, you can use DG_CONTROL / DAT_IDENTITY / MSG_USERSELEC to get the select source dialog box. ICAP_SUPPORTEDSIZE can be used for page size. For detailed information, you can refer to the specification:
    https://www.twain.org/docs/TWAIN_2_1_Spec.pdf

    ___________________
    Adam
    Dynamsoft: The leading developer of version control software and TWAIN SDK

    December 5, 2013 at 3:26 am #25541 Reply
    Nana111
    Participant
    • Topics - 0
    • Replies - 2
    • Total Posts - 2

    Hi there
    I have googled a code for tiff scanning:
    RasterEdgeImaging TIFF = new RasterEdgeImaging();
    public class AcquisitionClass
    {
    private bool AcquireCanceled;
    private Acquisition Acquisition = new Acquisition(this);
    public void Scan()
    {
    AcquireCanceled = false;
    Acquisition.AcquireCanceled += new EventHandler(OnAcquireCanceled);
    Acquisition.AcquireFinished += new EventHandler(OnAcquireFinished);
    Acquisition.ImageAcquired += new ImageAcquiredEventHandler(OnImageAcquired);
    Device activeDevice = Acquisition.ShowSelectSource();
    activeDevice.Acquire();
    }
    private void OnImageAcquired(object sender, AcquireEventArgs e)
    {
    if (e.Image != null)
    {
    TiffEncoder enc = new TiffEncoder(TiffCompression.Default, true);
    FileStream fs = new FileStream(“1.tif”,FileMode.OpenOrCreate, FileAccess.ReadWrite);
    enc.Save(fs, AtalaImage.FromBitmap(e.Image), null);
    fs.Close();
    }
    }
    private void OnAcquireCanceled(object sender, EventArgs e)
    {
    AcquireCanceled = true;
    }
    private void OnAcquireFinished(object sender, EventArgs e)
    {
    if (AcquireCanceled)
    return;
    TiffImageCollection col = new TiffImageCollection();
    TiffDecoder dec = new TiffDecoder();
    FileStream fs = new FileStream(“1.tif”, FileMode.Open, FileAccess.Read);
    int frameCount = dec.GetFrameCount(fs);
    fs.Close();
    for(int i=0; i< frameCount; i++)
    col.Add(new TiffImage(“1.tif”, i, TiffCompressionType.Auto));

    FileStream outStream = new FileStream(“1.tiff”, FileMode.OpenOrCreate, FileAccess.ReadWrite);
    TiffEncoder enc = new TiffEncoder();
    enc.Save(outStream, col, null);
    }
    But it can not word effectively.What’s wrong with my code?
    Is there any powerful tiff processing program which supports to do that directly?Thanks a lot.

    January 27, 2014 at 7:19 am #25542 Reply
    peterlee
    Participant
    • Topics - 0
    • Replies - 24
    • Total Posts - 24

    @Nana111 wrote:

    Hi there
    I have googled a code for
    tiff scanning:

    RasterEdgeImaging TIFF = new RasterEdgeImaging();
    public class AcquisitionClass
    {
    private bool AcquireCanceled;
    private Acquisition Acquisition = new Acquisition(this);
    public void Scan()
    {
    AcquireCanceled = false;
    Acquisition.AcquireCanceled += new EventHandler(OnAcquireCanceled);
    Acquisition.AcquireFinished += new EventHandler(OnAcquireFinished);
    Acquisition.ImageAcquired += new ImageAcquiredEventHandler(OnImageAcquired);
    Device activeDevice = Acquisition.ShowSelectSource();
    activeDevice.Acquire();
    }
    private void OnImageAcquired(object sender, AcquireEventArgs e)
    {
    if (e.Image != null)
    {
    TiffEncoder enc = new TiffEncoder(TiffCompression.Default, true);
    FileStream fs = new FileStream("1.tif",FileMode.OpenOrCreate, FileAccess.ReadWrite);
    enc.Save(fs, AtalaImage.FromBitmap(e.Image), null);
    fs.Close();
    }
    }
    private void OnAcquireCanceled(object sender, EventArgs e)
    {
    AcquireCanceled = true;
    }
    private void OnAcquireFinished(object sender, EventArgs e)
    {
    if (AcquireCanceled)
    return;
    TiffImageCollection col = new TiffImageCollection();
    TiffDecoder dec = new TiffDecoder();
    FileStream fs = new FileStream("1.tif", FileMode.Open, FileAccess.Read);
    int frameCount = dec.GetFrameCount(fs);
    fs.Close();
    for(int i=0; i< frameCount; i++)
    col.Add(new TiffImage("1.tif", i, TiffCompressionType.Auto));

    FileStream outStream = new FileStream("1.tiff", FileMode.OpenOrCreate, FileAccess.ReadWrite);
    TiffEncoder enc = new TiffEncoder();
    enc.Save(outStream, col, null);
    }

    But it can not word effectively.What’s wrong with my code?
    Is there any powerful
    tiff processing program which supports to do that directly?Thanks a lot.

    Hi, Nana111.
    Using code to deal with the related problem is too complicated for me. Why not use some professional tools? You can google it and have a try. I hope you success. Good luck.

    Best regards,
    Peter

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Capabilitie Trouble when 16 Bit Grayscale Tiff Scanning
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.