Component: Twain 
-----------------

Functions to acquire images from scanners.

See newer [WIA](component_WIA.md) functions for Windows and newer [ImageCapture](component_ImageCapture.md) functions for MacOS.

| Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|
| [3.1](newinversion31.md "First functions introduced with version 3.1.") / [5.1](newinversion51.md "Newest functions in version 5.1.") | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

  
| Item | Details |
|:--|:--|
| [Twain.Acquire](TwainAcquire.md)   Acquires a picture. | Mac/Win   3.1 |
| [Twain.ClearCancelScript](TwainClearCancelScript.md)   Clears the cancel script. | Mac/Win   3.3 |
| [Twain.ClearNotificationScript](TwainClearNotificationScript.md)   Clears the notification script. | Mac/Win   3.3 |
| [Twain.CloseDS](TwainCloseDS.md)   Closes data source. | Mac/Win   3.1 |
| [Twain.CloseDSM](TwainCloseDSM.md)   Closes data source manager. | Mac/Win   3.1 |
| [Twain.CurrentDSIdentity](TwainCurrentDSIdentity.md)   Queries current data source. | Mac/Win   3.1 |
| [Twain.CurrentImage](TwainCurrentImage.md)   Queries the current image from last query. | Mac/Win   3.1 |
| [Twain.DisableDS](TwainDisableDS.md)   Disables the data source. | Mac/Win   3.1 |
| [Twain.GetAutofeed](TwainGetAutofeed.md)   Queries whether plugin should auto feed (if feeder is enabled). | Mac/Win   3.1 |
| [Twain.GetAutomaticBorderDetection](TwainGetAutomaticBorderDetection.md)   Queries whether plugin should enable automatic border detection. | Mac/Win   3.3 |
| [Twain.GetAutomaticBrightness](TwainGetAutomaticBrightness.md)   Queries the Source's Auto-brightness function (if any). | Mac/Win   3.5 |
| [Twain.GetAutomaticRotate](TwainGetAutomaticRotate.md)   Queries whether plugin should enable automatic rotation. | Mac/Win   3.3 |
| [Twain.GetBrightness](TwainGetBrightness.md)   Queries the brightness setting to use. | Mac/Win   3.5 |
| [Twain.GetCloseAfterTransfer](TwainGetCloseAfterTransfer.md)   Whether to close window and data source after a transfer. | Mac/Win   3.1 |
| [Twain.GetCompressionQuality](TwainGetCompressionQuality.md)   Queries the current quality setting. | Mac/Win   3.1 |
| [Twain.GetContrast](TwainGetContrast.md)   Queries which contrast value to use. | Mac/Win   3.5 |
| [Twain.GetDSIdentitiesCount](TwainGetDSIdentitiesCount.md)   Queries number of data sources. | Mac/Win   3.1 |
| [Twain.GetDSIdentity](TwainGetDSIdentity.md)   Queries data source with given index. | Mac/Win   3.1 |
| [Twain.GetDefaultIdentity](TwainGetDefaultIdentity.md)   Queries default data source. | Mac/Win   3.1 |
| [Twain.GetDiscardBlankPages](TwainGetDiscardBlankPages.md)   Queries whether plugin should enable feeder. | Mac/Win   3.2 |
| [Twain.GetDuplexEnabled](TwainGetDuplexEnabled.md)   Queries whether plugin should enable feeder. | Mac/Win   3.2 |
| [Twain.GetFeededEnabled](TwainGetFeededEnabled.md)   Queries whether plugin should enable feeder. | Mac/Win   3.1 |
| [Twain.GetFilePaths](TwainGetFilePaths.md)   Queries the list of file paths used to create files. | Mac/Win   3.1 |
| [Twain.GetFileType](TwainGetFileType.md)   Queries the current file type. | Mac/Win   3.1 |
| [Twain.GetFolderPath](TwainGetFolderPath.md)   Queries the folder path. | Mac/Win   3.1 |
| [Twain.GetGamma](TwainGetGamma.md)   Queries the gamma correction value for the image data. | Mac/Win   3.5 |
| [Twain.GetHighlight](TwainGetHighlight.md)   Queries which value to use for highlight. | Mac/Win   3.5 |
| [Twain.GetImageCount](TwainGetImageCount.md)   Queries the number of images in memory. | Mac/Win   3.1 |
| [Twain.GetOrientation](TwainGetOrientation.md)   Queries current orientation. | Mac/Win   3.1 |
| [Twain.GetPaper](TwainGetPaper.md)   Queries the paper to use. | Mac/Win   5.1 |
| [Twain.GetPixelType](TwainGetPixelType.md)   Queries current pixel type setting. | Mac/Win   3.1 |
| [Twain.GetResolutionX](TwainGetResolutionX.md)   Queries the current resolution setting for the next scan. | Mac/Win   3.1 |
| [Twain.GetResolutionY](TwainGetResolutionY.md)   Queries the current resolution setting for the next scan. | Mac/Win   3.1 |
| [Twain.GetShadow](TwainGetShadow.md)   Queries which value in an image should be interpreted as the darkest shadow. | Mac/Win   3.5 |
| [Twain.GetUIVisible](TwainGetUIVisible.md)   Queries internal state from plugin about whether a TWAIN dialog is visible currently. | Mac/Win   3.3 |
| [Twain.ImageInfo](TwainImageInfo.md)   Queries image details for last scanned image. | Mac/Win   3.1 |
| [Twain.Initialize](TwainInitialize.md)   Initializes the Twain functions. | Mac/Win   3.1 |
| [Twain.IsDSEnabled](TwainIsDSEnabled.md)   Whether data source is enabled. | Mac/Win   3.1 |
| [Twain.IsInitialized](TwainIsInitialized.md)   Checks if Twain library has been initialized. | Mac/Win   4.2 |
| [Twain.OpenDS](TwainOpenDS.md)   Opens a data source. | Mac/Win   3.1 |
| [Twain.OpenDSM](TwainOpenDSM.md)   Opens data source manager. | Mac/Win   3.1 |
| [Twain.SelectDS](TwainSelectDS.md)   Queries dialog to ask the user to select a data source. | Mac/Win   3.1 |
| [Twain.SelectDSIdentity](TwainSelectDSIdentity.md)   Sets current data source. | Mac/Win   3.1 |
| [Twain.SetAutofeed](TwainSetAutofeed.md)   Whether to enable auto feed when next scan starts. | Mac/Win   3.1 |
| [Twain.SetAutomaticBorderDetection](TwainSetAutomaticBorderDetection.md)   Whether to enable automatic border detection when next scan starts. | Mac/Win   3.3 |
| [Twain.SetAutomaticBrightness](TwainSetAutomaticBrightness.md)   Enables or disables the Source's Auto-brightness function (if any). | Mac/Win   3.5 |
| [Twain.SetAutomaticRotate](TwainSetAutomaticRotate.md)   Whether to enable automatic rotation when next scan starts. | Mac/Win   3.3 |
| [Twain.SetBrightness](TwainSetBrightness.md)   Sets the brightness setting to use. | Mac/Win   3.5 |
| [Twain.SetCancelScript](TwainSetCancelScript.md)   Sets the script to call when a dialog was shown and the user pressed Cancel button. | Mac/Win   3.3 |
| [Twain.SetCloseAfterTransfer](TwainSetCloseAfterTransfer.md)   Whether to close window and data source after a transfer. | Mac/Win   3.1 |
| [Twain.SetCompressionQuality](TwainSetCompressionQuality.md)   Sets the compression quality for JPEG images. | Mac/Win   3.1 |
| [Twain.SetContrast](TwainSetContrast.md)   Sets which contrast value to use. | Mac/Win   3.5 |
| [Twain.SetDefaultDSIdentity](TwainSetDefaultDSIdentity.md)   Sets default data source. | Mac/Win   3.1 |
| [Twain.SetDiscardBlankPages](TwainSetDiscardBlankPages.md)   Whether to have the scanner ask to discard blank pages. | Mac/Win   3.2 |
| [Twain.SetDuplexEnabled](TwainSetDuplexEnabled.md)   Whether to enable duplex when next scan starts. | Mac/Win   3.2 |
| [Twain.SetFeededEnabled](TwainSetFeededEnabled.md)   Whether to enable feeder when next scan starts. | Mac/Win   3.1 |
| [Twain.SetFileType](TwainSetFileType.md)   Sets the file type to use for writing image files. | Mac/Win   3.1 |
| [Twain.SetFolderPath](TwainSetFolderPath.md)   Sets the folder path for storing image files. | Mac/Win   3.1 |
| [Twain.SetGamma](TwainSetGamma.md)   Sets the gamma correction value for the image data. | Mac/Win   3.5 |
| [Twain.SetHighlight](TwainSetHighlight.md)   Specifies which value in an image should be interpreted as the lightest highlight. | Mac/Win   3.5 |
| [Twain.SetNotificationScript](TwainSetNotificationScript.md)   Sets the script to call when a transfer is complete and you can query image. | Mac/Win   3.1 |
| [Twain.SetOrientation](TwainSetOrientation.md)   Sets current orientation. | Mac/Win   3.1 |
| [Twain.SetPaper](TwainSetPaper.md)   Requests to use a certain paper. | Mac/Win   5.1 |
| [Twain.SetPaperSize](TwainSetPaperSize.md)   Requests a page size in inches. | Mac/Win   5.1 |
| [Twain.SetPixelType](TwainSetPixelType.md)   Sets the pixel type requested on next Twain.Acquire command. | Mac/Win   3.1 |
| [Twain.SetResolutionX](TwainSetResolutionX.md)   Sets the horizontal resolution for scanning. | Mac/Win   3.1 |
| [Twain.SetResolutionY](TwainSetResolutionY.md)   Sets the vertical resolution for scanning. | Mac/Win   3.1 |
| [Twain.SetShadow](TwainSetShadow.md)   Specifies which value in an image should be interpreted as the darkest shadow. | Mac/Win   3.5 |
| [Twain.SupportsBW](TwainSupportsBW.md)   Whether device supports black and white pixel type. | Mac/Win   3.1 |
| [Twain.SupportsGray](TwainSupportsGray.md)   Whether current device supports gray pixel type. | Mac/Win   3.1 |
| [Twain.SupportsMemoryTransfer](TwainSupportsMemoryTransfer.md)   Whether device supports memory transfers. | Mac/Win   3.1 |
| [Twain.SupportsRGB](TwainSupportsRGB.md)   Whether current device supports RGB pixel type. | Mac/Win   3.1 |
| [Twain.TransferImage](TwainTransferImage.md)   Transfers an image. | Mac/Win   3.1 |

73 functions shown.

### Release notes

- **Version 14.5**
    - Fixed an issue with [GMImage.WriteToPDFContainer](https://www.mbsplugins.eu/GMImageWriteToPDFContainer.shtml) and [Twain.Acquire](https://www.mbsplugins.eu/TwainAcquire.shtml) on Windows.
- **Version 14.4**
    - Improved [Twain.Initialize](https://www.mbsplugins.eu/TwainInitialize.shtml) to return better error messages on Windows.
- **Version 11.4**
    - Fixed problem in [Twain.Acquire](https://www.mbsplugins.eu/TwainAcquire.shtml) to fail better if we can't open the data source.
- **Version 9.2**
    - Changed plugin to not link to [EventKit](https://www.mbsplugins.eu/component_Events.shtml) functions, [CalendarStore](https://www.mbsplugins.eu/component_Calendar.shtml) and [TWAIN](https://www.mbsplugins.eu/component_Twain.shtml) frameworks directly.
- **Version 7.2**
    - Added BringWindowToFront parameter to [Twain.Acquire](http://www.mbsplugins.eu/TwainAcquire.shtml) function.

### Blog Entries

- [MBS @ FMTraining.TV - Scanning in FileMaker with the MonkeyBread Plug-in](https://www.mbsplugins.de/archive/2024-04-28/MBS_@_FMTrainingTV_-_Scanning_/monkeybreadsoftware_blog_filemaker)
- [Ways to import images to FileMaker](https://www.mbsplugins.de/archive/2022-02-09/Ways_to_import_images_to_FileM/monkeybreadsoftware_blog_filemaker)
- [Combine MBS functions to automate processes in FileMaker](https://www.mbsplugins.de/archive/2019-04-11/Combine_MBS_functions_to_autom/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 6.5 for OS X/Windows](https://www.mbsplugins.de/archive/2016-12-12/MBS_FileMaker_Plugin_65_for_OS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 6.4 for OS X/Windows](https://www.mbsplugins.de/archive/2016-09-27/MBS_FileMaker_Plugin_64_for_OS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 3.2 for OS X/Windows](https://www.mbsplugins.de/archive/2013-05-07/MBS_FileMaker_Plugin_32_for_OS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 3.1 for OS X/Windows - More than 1400 Functions In One Plugin](https://www.mbsplugins.de/archive/2013-02-12/MBS_FileMaker_Plugin_31_for_OS/monkeybreadsoftware_blog_filemaker)

### Example Databases

- [Mac and iOS/PDFKit/Pictures to PDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Pictures%20to%20PDF.shtml#4ScriptAnchor_)
- [Win Only/Scanning/Twain](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/Scanning/Twain.shtml#1ScriptAnchor_)

[HTML Version](component_Twain.shtml)