VBA code to import scanned images into Photoshop CS2 with TWAIN

Hi,
I have to develop a solution that automates the scanning of an image using the TWAIN driver interface. Once scanned, the image appears as a new document in Photoshop where it will be further processed using VBScript scripts.
The solution so far :
Using the freeware 'EZTW32.dll' (copied into C:\WINDOWS\System\), I am able to open the TWAIN scan dialogue on screen, using the function 'TWAIN_AcquireToClipboard(Me.Hwnd, nPixTypes) from the 'EZTW32' dll.
Once the image is scanned, the TWAIN driver is automatically closed, leaving the scanned image on the Windows clipboard.
I then launch Photoshop CS2 using a shell code :
(It is important that Photoshop runs minimized)
Dim strPathname As String
Dim lngShellReturn As Long
Dim appRef As Object
Dim newDocRef
strPathname = "C:\Program Files\Adobe\Adobe Photoshop CS2\Photoshop.exe"
lngShellReturn = Shell(strPathname, vbMinimizedNoFocus)
Set appRef = CreateObject("Photoshop.Application")
When Photoshop is running, then a new document is created and the scanned image is pasted into the document from the Windows clipboard...
Set newDocRef = Documents.Add(8.268, 11.693, 600, "New Doc")
newDocRef.Paste
OK, this works up to a point. The newly scanned image appears automatically in Photoshop.
The big problem is that when the user makes a change in resolution or draws a selection box in the TWAIN dialog, this data is not recovered from TWAIN, so the image size parameters in the new document cannot be set.
A beter solution would be to write code that emulates the menu commands in Photoshop CS2:
File -> Import -> [Current Scanner]
that launches the TWAIN driver for the current scanner (the code must close TWAIN immediately after scanning). In this case, the resolution and image selection parameters are also imported into the new document.
I am currently refering to the Photoshop CS2 SDK. Do I need to request the Advanced SDK ?
Once beyond this point, then I think I can continue the image processing routines using VBScript as per the SDK.
Any help or other pointers to the TWAIN problem would be VERY APPRECIATED !
Lars

PLEASE IGNORE MY PREVIOUS POST !
I have now fully resolved the TWAIN problem. It works perfectly and is very robust. I am now continuing with the batch image processing for the newly scanned images using the Photoshop CS2 SDK scripting documents, that I find very detailed, well written, and VERY helpful :)
Peace and love,
Lars

Similar Messages

  • Why does Aperture crash when importing modified image into Photoshop CS2?

    I have been using Aperture 2.1.4 for the past 2 years and really like the interface. But, I've had one nagging problem: I begin by scanning all of my slides with the Nikon Coolscan 4000 and save them as large tiff files @ approx. 55mb each. I then import each slide with a custom color profile into Aperture. I then optimize the image including white balance, levels, and color adjustments. When I want to make additional changes that I'm not able to do in Aperture, I attempt to send the image to Photoshop CS2 for further processing. But, at this point, Aperture crashes. After this, I get a message saying "do you want to re-open Aperture or quit?" Additionally, I often get the message "Aperture has applied new settings. Do want to keep these new settings or use the original settings?" Since I don't know what will happen if I choose "use the new settings," I always select "keep the original settings." And, when I open Aperture again and try, again, to send the image to Photoshop CS2 to edit, Aperture crashes again. Has anyone had the same or similar problem who can give me some ideas of how to solve this issue! Thanks.

    Welcome to the forums!
    It sounds like there may be a permissions issue between the two apps, Aperture using one and PS another.
    1. Are you logged in as an administrator?
    You need to be.
    2. Where is your library stored, is it in the picture folder of your user directory?
    If so moving it in to the general area of your MacHD may help get over some of these issues.
    3. Have you run any of the Ap First Aid steps? Have a read of this page;
    Ap2
    http://support.apple.com/kb/HT2945
    Ap3
    http://support.apple.com/kb/HT3805
    4. Is it possible that the upgrade to Ap3 would get you around the need to jump into PS?
    Start with these ones and then come back letting us know how you go.
    Tony
    Message was edited by: Tony Gay Added Ap2 First Aid link.

  • Have Photoshop Elements 12, recently purchased Epson Workforce WF-7620 Printer/scanner , cannot import scanned pictures into Photoshop, does not see the Printer/scanner.

    How can I get my Photoshop Elements 12 to import scanned images from my Epson Workforce WF-7620 ?. The program does not recognise the Priner/scanner.
    Bruce

    Is it trying to get you to join photoshop.com? The easiest way around that is not to use the welcome screen. Go into the program files and make direct shortcuts for the organizer and/or editor and start PSE that way from now on. Photoshop.com is dead and gone so the welcome screen will hang up trying to connect to something that no longer exists.

  • How can I import scanned images into InDesign CS5 using Mac10.6?

    I want to be able to import scanned images. What file format must I save the data in?

    Greg Parks L.A. wrote:
    For example, to print on a press you need images that are CMYK at 300 ppi, 100% scale. If you're just making office-quality documents or PDFs, you can use RGB images at a lower resolution.
    You do not need images to be CMYK for print. InDesign can handle the conversion from RGB to CMYK when exporting to PDF. The old rule of thumb that images for print need to be 300 ppi is history. The ideal minimum resolution is halftone screen times the square root of 2 (1.41421356). But you can get away with a lower resolution for most images.

  • Can't import CR2 images into PHotoshop Elements 9

    Please could someone help me with importing CR images from my Canon S120 camera...it just says doesn't recognise file type?

    You need camera raw 8.3 for your camera. It is only compatible with PSE12 or PSE13. Alternatively, download and install the free Adobe DNG converter to convert your raw files to the Adobe universal Raw format and the files will open in all versions of PSE (keep your originals as backups and for use in the camera manufactures software)
    Windows download (.exe file) click here DNG Converter 8.3
    Mac download (.dmg file) click here DNG Converter 8.3
    You can convert a whole folder of raw images in one click. See this quick video tutorial:
    You Tube click here for DNG Converter tutorial

  • Can't scan images into photoshop after installing Yosemite

    Why am i getting the following error message after installing Mac OS X 10.10 Yosemite and trying to scan in photos through Photoshop CS6: Could not complete your request because a SOFn, DQT, or DHT JPEG marker is missing before a JPEG SOS marker?

    MP Navigator is a Canon product, first check with Canon to see if they have a Yosemite compatible version.

  • How do I resize an image in Photoshop CS2?

    Hi! I'm trying to resize an image in Photoshop Cs2 with OUT making it grainy or blurred. Please help!? I know there's some key you can hold down while dragging with the mouse but eh I forgot it! o_0 please help!

    Jody...
    If you have a vector version of the logo, the smartest thing is to resize it as vectors to the size you want, and
    then
    rasterize it.
    Case in point:
    I was trying to make a 16px × 16px favicon for my blogspot site, and the only way I could get the details to appear nice and clean was to create the entire thing from shape layers, transform them all in one go to fit inside a 16px × 16px box I defined using guidelines, and THEN rasterize it using the Save For Web dialogue.

  • I am trying to import scanned illustrations into Final Cut Pro (6) as layered photoshop images, however when I try and animate the image is blurred.....please help!

    I am trying to import scanned illustrations into Final Cut Pro (6) as layered photoshop images, however when I try and animate the image is blurred.....please help! Will I need to create the photoshop files as a certain size/resolution? I am working to 4:3.....

    You should take your question to the Final Cut Studio forum. This is FCPX.

  • Using photoshop elements 13 but the option to crop a single image is grayed out and also the option to crop a scanned image into individual pictures is grayed out - any ideas?

    The option to crop an image is always grayed out or unavailable - both for single images and when I want to crop scanned images into individual pictures. Any idea what I may be doing wrong?

    Did you try using the crop tool to see if it is working?  See the tool I am talking about.
    I suspect you are in Guided Mode rather than in Quick Mode or Expert Mode.

  • Unable to load TIF images into Photoshop.

    CS4 (11.0.2) and Windows 7 Home Edition.
    Have developed a problem trying to load some TIF images into Photoshop. I have a large number of images archived over a decade or more. At this point it may some of the older files that exhibit the problem. Now all these files were edited and stored using the Photoshop versions during the complete time period. The files are always saved with no compression. Have tried to load from Photoshop and clicking on the file in a file list. Photoshop just hangs and I get the message Program not responding. I can take these same files and load them into the ROXIO photo editor with no problem. Stranger yet is if I simply load the file into the ROXIO editor then "save as" back into the same folder (overwrite) the file can then be brought into Photoshop with no problem! Any ideas?

    Noel,
    Will try to keep short.
    I reinstalled Photoshop CS4 from the cd CS set. Did not uninstall first. Restarted PC and Photoshop. Still failed the same way with a 3001 image.
    Did the following, changing one item in the Edit->Preference->GPU Setting. After each change, closed Photoshop, reopened, brought in 3001 image, restored original setting. 3001 failed each time.
    * Unchecked Enable OpenGL Drawing
    * Advanced setup: Unchecked Advanced Drawing.
    * Advanced setup: Unchecked Color Matching
    Next went to the Edit->Color Profile.
    Scanned thru options and saw in the Convert Options: Engine. It was set to Adobe (ACE). ACE was the module name in the error detail!
    Only other option for this is Microsoft ICM. Changed to that, close/open Photoshop and 3001 came in no problem. So did the Nikon 3000, srgb IEC 61922 2.1 and Untagged. However, when briging in an Adobe RGB(1998) image Photoshop notes Profile Mismatch. It allows me to decide what to do (use embedded profile instead of workspace; convert color to work space color; discard embedded profile. and I choose use the convert color and it loads ok. At least it loads the image! Will use this approach for now. I need to get educated on color profiles!!
    Joe

  • Getting error could not place the document because there is not enough memory RAM wile importing .png file into Photoshop cc

    getting error could not place the document because there is not enough memory RAM wile importing .png file into Photoshop cc

    Without knowing anything about your system, your image file, your working document and so on nobody can even begin to guess. The file could be damaged, there could be color management issues at play and what have you...
    Mylenium

  • Importing a pdf into photoshop CC and it corrupts the artwork slightly but in older photoshop version it does not corrupt?

    Hi
    When Importing a pdf into photoshop CC it corrupts the artwork slightly but in older photoshop version it does not corrupt? Please help as this corruption slightly marked the artwork, it was then printed and is going to cost my company thousands to replace. [email protected]

    "Slightly corrupted" sounds very much akin to "slightly pregnant".  Hard to imagine.
    I assume you're referring to some sort of image quality deterioration or some added artifacts.
    Could you post a screen shot?  Just so that someone familiar with PDFs opened in CC can form an idea of the nature of the "corruption" and where the cause might lie.
    If you post back, please give complete hardware and software details about your setup, including the exact version of CC so they can see if all updates have been applied.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    software settings,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them, etc.,
    someone may be able to help you (not necessarily this poster).
    A screen shot could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • When importing an image into Flash, the filesize is reported incorrectly

    I saved an image from Photoshop using "Save for Web" and managed to bring the filesize down to 56.5kb. When I import this image into Flash and click on the properties, the reported "Original" filesize is 1884.6kb which is a heck of a lot more. How can I import the image and retain the filesize without having to compress the image further causing a horrible quality image?

    right click one of your bitmaps, click properties and tick "allow smoothing".  retest.

  • Mac Wizards! Stuck importing multiple images into individual cells...

    Hi folks,
    I'm new to the Mac (yeah!) and imagine there just has to be a way to import a bunch of images into separate cells in Mac "Numbers" ... am I right?
    Essentially what I'd like to do is a file folder with 600 images in it, and import those directly into Mac Numbers with one picture being assigned to it's own cell. So if below were a spreadsheet it would look like this:
    Actual Picture - Picture Name - Item Description ... and so on.
    I'm trying to work with inventory items, and this is the only way I can think of doing it. Suggestions!?!?
    Here is a link to creating a macro in Excel to do a similar thing:
    http://en.kioskea.net/forum/affich-269046-adding-a-loop-to-macro-to-insert-pictu res
    Thanks for your help.
    D

    There is no macro feature in Numbers.
    The only way to code what you wish would be to use AppleScript if Numbers '08 was scriptable.
    As it's not, you must do the job by hand or switch to Numbers '09 which is scriptable.
    Yvan KOENIG (VALLAURIS, France) mercredi 3 mars 2010 22:10:14

  • Dividing Scanned Image into Separate Photos

    I would like to divide a scanned image into separate photos. I understand Photoshop Elements can do this under Images > Divide Scanned Image. But, I can't find this command in Photoshop CS5. Without it being done automaticaly how can I divide the image using CS5? Thanks.

    File -> Automate -> Crop and Straighten Photos

Maybe you are looking for

  • Error in writing to directory /tmp/OraInstall2009-09-18_09-03-18AM. Please

    Hi all, oracle Unbrekable linux 32 bit oracle 10.2.0.1 i got this error while installing oracle universal installer [vishal@localhost database]$ ./runInstaller Starting Oracle Universal Installer... Checking installer requirements... Checking operati

  • Photo Gallery Blacks Outs

    I have found that some times when I zoom into a photo the screen will black out but if I double tap to zoom out to normal it returns but will refuse to show a zoom unless I restart the phone. It has also on occasion just gone black and not let me zoo

  • Text editor with 15 lines

    Hi all, I have a requirement to create a text editor. I created a Text editor,but where i need only 15 lines to update into it . But it showing 22 lines and some times 30 lines . Anybody let me know how to update Text editor with 30 lines . Regards,

  • Workflow and BSP?

    Hallo, how difficult is it to use workflow with BSP? 1)Are there tools orde wizzards, WYSIWYG to set up the workflow with bsp? 2) How is to realize the connection between workflow-container and BSP? 3) Is ist possible to attach files to a BSP and sto

  • Pros And Cons Of Using An External USB 2.0/FW DVD Burner ?

    This is not entirely an iDVD query, though iDVD is the proram that will be using the DVD burner most. (I have also posted it on the iMac forum but received no response yet and iDVD users are likely to be more knowledgeable about DVD burning). I inten