Sign in to follow this  
NisseBosseLasse

Twainable - Acquire from TWAIN sources v0.2.1 (updated 4 Oct 2010)

Recommended Posts

Updated 4 Oct 2010

The 4 October update is merely the addition of a stand-alone version of this application, for use on 64-bit Windows. For more information, continue to the bottom of this post. The original plugin hasn't changed for this release. I've decided to remove the stand-alone version to avoid further confusions.

Version 0.2.1

  • Added localization support (current only Swedish)

Version 0.2

  • Small change in the UI (new icon etc.)
  • Changed menu location from TWAIN to Tools

Version 0.1

  • First release

My first plugin! Hopefully someone finds it useful.

It's still in development (0.2.1), but it should work as expected.

Note

This plugin currently only works on 32-bit systems.

About

I wrote this effect to be able to use my "old" CanoScan LiDE 20 scanner from Paint.NET. It uses the EZTwain Classic DLL, and should be compatible with all scanners that are TWAIN-compatible.

Files included

Twainable.dll - The effect plugin (required)

EZTW32.dll - The EZTwain Classic DLL used by this plugin (required)

Twainable readme.txt - This file

sv-se.fxlang - Swedish localization

Installation

Place the files Twainable.dll and EZTW32.dll in the Effects folder of your Paint.NET installation folder.

(Optional) Placing the sv-se.fxlang file in the Effects folder will give you Swedish translation.

This plugin utilizes the plugin translation written by Simon Brown*. The file sv-se.fxlang contains translated entries for this plugin (currently only in Swedish). See Translation below if you want to translate these entries to your tongue.

The localization file isn't required by the plugin to function. If not found, it will use English as default. If you want to use it, place it in the same folder as the Twainable.dll file (that is, the Effects-folder).

*Note: the plugin translation code can be found in this forum thread:

http://forums.getpaint.net/index.php?/topic/18816-plugin-translation-scheme-including-code/

Usage

After placing both files in the Effects folder, (re-)start Paint.NET. The plugin can be found under the menu Effects->Tools->Acquire from TWAIN...

The main window consists of three buttons:

  • "Select Source..." lets you select which TWAIN-source to use
  • "Acquire to clipboard..." starts the scanner software, and stores the scanned image in the clipboard
  • "Close" closes the window

Translation

First, read the forum thread at http://forums.getpaint.net/index.php?/topic/18816-plugin-translation-scheme-including-code/ to get a better understanding on the format.

The entries that this plugin uses are the following:

<LANGCODE>:select source=<YOUR TRANSLATION>

<LANGCODE>:acquire=<YOUR TRANSLATION>

<LANGCODE>:close=<YOUR TRANSLATION>

<LANGCODE>:close window automatically=<YOUR TRANSLATION>

...where <LANGCODE> is the language code of your language (e.g. sv-se for Swedish, de for German, and so on), and <YOUR TRANSLATION> is of course the translation.

The file sv-se.fxlang contains several other entries as well, but these aren't used by this plugin.

References

EZTwain Classic DLL can be found here: http://www.dosadi.com/eztwain1.htm

Running on 64-bit systems

If you running a 64-bit system you may have come across the error message System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B). This is due to trying to run the plugin on a 64-bit system.

I've developed a stand-alone version of the plugin, for all you 64-bit users. It works in the same way, but doesn't required Paint.NET to run (it's a stand-alone, after all). Just download the "Twainable (stand-alone 0.1).zip" archive attached to this post, and read the file "Read me.txt" contained within. Removed as of 8 sep 2011.

Twainable.zip

Edited by NisseBosseLasse

Share this post


Link to post
Share on other sites

I'm currently making minor changes for the next release, so I'm eager to hear about improvements and/or experiments with the current version (does it work? :) ).

It's been downloaded 11 times, so I guess someone must've tried it!

Share this post


Link to post
Share on other sites

Doesnt work in Win7 x64:

Datei: C:\Program Files\Paint.NET\Effects\Twainable.dll

Effektname: Twainable.EffectPlugin

Vollständige Fehlermeldung: System.BadImageFormatException: Es wurde versucht, eine Datei mit einem falschen Format zu laden. (Ausnahme von HRESULT: 0x8007000B)

bei Dosadi.EZTwain.EZTwain.IsAvailable()

bei Twainable.EffectPluginConfigDialog.CheckAvailableTwain()

bei Twainable.EffectPlugin.CreateConfigDialog()

bei PaintDotNet.Menus.EffectMenuBase.RunEffectImpl(Type effectType) in D:\src\pdn\paintdotnet\src\PaintDotNet\Menus\EffectMenuBase.cs:Zeile 708.

Translation:

Complete Errormessage: System.BadImageFormatException: Tried to load a File with a wrong Format (Exception from HRESULT: 0x8007000B)

Although works fine on my XP x86 Laptop with same TWAIN 8) (Twain via Network for Lexmark X543)

Share this post


Link to post
Share on other sites

I am trying to use Paint.NET 3.5 Build 3.51.3610.35022 instead of MS Photodraw. I have installed the Twainable plug as directed to enable me to use my EPSON STYLUS PHOTO RX630. When I scan to the clipboard the EpsonScan page pops up but in Configuration on the Clor tab with ICM dotted I cannot find jpegs in the list (this what I have been using when I use EpsonScan externally to Scan old photos or film). I have tried all the options on the Target drop down. However in all cases when I click on the clipboard icon I am getting an error message "Image in the clipboard cannot be recognised -Try recopying etc".

Share this post


Link to post
Share on other sites

I also get the error when running windows 7 x64

File: D:\Program Files\Paint.NET\Effects\Twainable.dll

Effect Name: Twainable.EffectPlugin

Full error message: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

at Dosadi.EZTwain.EZTwain.IsAvailable()

at Twainable.EffectPluginConfigDialog.CheckAvailableTwain()

at Twainable.EffectPlugin.CreateConfigDialog()

at PaintDotNet.Menus.EffectMenuBase.RunEffectImpl(Type effectType) in D:\src\pdn\paintdotnet\src\PaintDotNet\Menus\EffectMenuBase.cs:line 708

Share this post


Link to post
Share on other sites

Hello again everybody, sorry for the absence.

This plugin is merely a wrapper around the EZTwain Classic-dll (not written by me, but Dosadi). According to their site, their DLL only supports 32-bit Windows.

So sorry, only 32-bit.

EDIT: this also explains the error message "System.BadImageFormatException: Tried to load a File with a wrong Format (Exception from HRESULT: 0x8007000B)" - this is due to loading the 32-bit DLL in a 64-bit environment.

Share this post


Link to post
Share on other sites

Hello to everybody,

I am a complete newcomer to this forum (actually to all techical forums) and tripped over this thread, since I have the same problem: my paint.net does not recognize/show my scanner canonScan Lide 20 when trying to acquire data from a scanner.

May you please be so kind and explain to me, where and how I can get the plugin you are talking about in this thread? What else is necessary to get my scanner running (aktually it works but does not cooperate with paint.net :()?

Thank you very much, sorry about these very basic questions

little onion (zwiebelchen in German)

Share this post


Link to post
Share on other sites

The download link for this plugin is at the very bottom of the first post in this thread.

Click where it says, Twainable.zip

-----------------------------------------

Inside the zip is a readme.txt that explains what to do.

Edited by Sarkut

Share this post


Link to post
Share on other sites

Raalpha9: good to hear!

I've updated the original post about the new stand-alone version of this plugin. It should resolve the issue when trying to run this plugin on a 64-bit system (the infamous System.BadImageFormatException error message).

Share this post


Link to post
Share on other sites

First off: Thank You! Thank You! Thank You!

I recently needed to dust off my old Canon LiDE 50 scanner and run a document through it. After doing the driver song and dance on Windows 7, I had the scanner working but only through the TWAIN interface... any of this sound familiar? So yes, thank you very much!

I did want to provide some feedback as well:

1) Repeating the "effect" doesn't seem to do anything other than pull the data in from the clipboard again.

2) I would really like to have an option to "scan to new image" or "scan to new layer" to skip the pasting step. This could also be used to keep mounds of data off the clipboard.

3) While I don't personally care, I kind of like the older option of having TWAIN appear under the Acquire menu better than an effect. Even though this is an "effect". Just wanted to throw my hat in the ring on this one...

Any chance you would consider opening the source and posting it on BitBucket, GitHub or CodePlex?

Share this post


Link to post
Share on other sites

goyuix: nice to hear it's working for you!

Repeating the "effect" doesn't seem to do anything other than pull the data in from the clipboard again.

Probably true. I've never used the plugin in that way and therefore never actually thought of it. I'll look into it!

I would really like to have an option to "scan to new image" or "scan to new layer" to skip the pasting step. This could also be used to keep mounds of data off the clipboard.

Good suggestions - maybe for the next release! The Paint.NET API isn't something I quite master (yet?), so I'm unsure if effects are able/allowed to tamper with creating new images, or new layers. But it would be a good feature, nonetheless.

While I don't personally care, I kind of like the older option of having TWAIN appear under the Acquire menu better than an effect. Even though this is an "effect". Just wanted to throw my hat in the ring on this one...

As you probably already figured out, this isn't something I as an effect developer can change.

Any chance you would consider opening the source and posting it on BitBucket, GitHub or CodePlex?

Absolutely, for the next release. I've been working on a fresh code base that doesn't use the Dosadi EZTwain-DLL, and when it's mature enough I'll probably upload it somewhere (Google Code?).

Share this post


Link to post
Share on other sites

Dear entusiast i have used your file on mustek scanner a3 usb but after acquiring the image, it appears entirely white... how is it possible? Thanks for every help you may give to me. and compliment for your work.

Morris.

Edited by azrael5

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this