Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm currently working on a project where we want to interface with TWAIN scanners on both the PC (Windows) and the Macintosh.

On Windows, we basically have everything squared away and the code works successfully with the vast majority of scanners.

On Mac OS X, we also basically have everything working and with the main scanner we used to develop the application with works perfectly, but we're not having a ton of luck with other scanners. As a byproduct of development on this project, we have a fair number of scanners from various manufacturers on-hand to test with. The results vary wildly:

  • The scanner we used to develop with works perfectly on Mac OS X as it does in Windows. Ironically this scanner is the cheapest and crappiest scanner (speed-wise) we've ever encountered but it's been a dream to work with.
  • Another scanner works great - until the second or third scan, at which point the application crashes with no clear indication of what happened (we get an EXEC_BAD_ACCESS from the debugger)
  • Another scanner apparently has no TWAIN support on Mac OS X (no data sources in the "Image Capture/TWAIN Data Sources" folder), although it does have TWAIN support in Windows.
  • Another scanner has a generic data source that I'm thinking is supposed to cover all the possible scanners from this manufacturer but when we try to initiate a native scan (which is a requirement for all TWAIN data sources) we get no results. Also, trying to install a second scanner from this manufacturer gums everything up and requires a manual uninstall for everything from this company.
  • Another scanner has a TWAIN data source that appears to be specific to the manufacturer, but it also fails to initiate a native scan (but a scan using the native GUI - which is incompatible with our project - works)

So I'm not sure where to go with this. I'm still digging into the code to figure out what, if anything, we're doing wrong but in checking against the TWAIN standard it really does look like we're doing everything right, but we're getting very hit-or-miss results on most of the scanners we're testing against.

Also, as part of the new Cocoa/Carbon Events model there's this additional consideration of a "callback" function that Mac OS X TWAIN data sources are supposed to implement and I'm not seeing it called from most of these data source/drivers.

So all of this leads me to wonder - is it that we're just doing something wrong or is TWAIN just not supported properly by and large on the Macintosh?

I'm really not seeing a lot of information on TWAIN on the Macintosh online - the occasional sporadic inquiry on twainforum.org tends to go unanswered. Windows also has a thing called WIA - Windows Image Acquisition - and on the Windows side we also include this as an option. Is there something else on the Mac we should be exploring instead of or in addition to TWAIN?

NOTE: I've posted this same question on StackOverflow but got no responses and after consulting meta, I've decided to re-post it here (since it's more discussion than specific). If this is a big no-no feel free to delete this thing.

share|improve this question
add comment

1 Answer

Very interesting, given that TWAIN evolved from work by the Macintosh Scanner Roundtable in the early 90s.

I did a little TWAIN client project about five years ago on OS X, and the few scanners I threw at it worked fine. Maybe things have changed since then and manufacturers have dropped support or done a half-baked job; I just don't know.

If I were you, I'd try Thorsten Lemke's GraphicConverter with your scanners. It's got pretty good basic TWAIN support, and the results will give you an indication of whether the problems you're seeing are on the manufacturer's (scanner, driver) side, or in your own code.

It looks like there's a new standard called SANE that appears to have started on Linux and migrated to the Mac. A lot of Mac folks are using it with scanners that have poor TWAIN support, and there's also a SANE-to-TWAIN bridge.

share|improve this answer
    
Yeah my boss found this article yesterday which says the TWAIN plugin for Photoshop on the Mac is "use at your own risk" forums.macrumors.com/archive/index.php/t-601929.html which is doubly interesting because Photoshop got its start in the form of a floppy disk shipping with scanners. –  Schnapple Oct 29 '10 at 14:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.