Wednesday, July 27, 2011

Copy & Paste of images with SnagIt and Gmail - Resolved

I'm a consultant and my primary method of communication with my clients is email. I have been a heavy user of Gmail (Google Apps) through Google Chrome and so far so good. However, my biggest complain has always been lack of Copy and Paste support for images especially screen captures. I was pleasantly surprise to hear the recent development regarding an ability to paste images directly into a message body. Unfortunately, my excitement didn't last long when I discovered this new functionality is not currently compatible with Snagit. I have been using Snagit since its infancy and I have always considered it one the best screen capture apps in the market today and naturally I didn't want to switch. The issue is that if you attempt to paste a recently captured screen shot into a Gmail message, The image is displayed as a transparent frame instead and the actual content is lost.



I was able to confirmed and reproduce this on different versions of Windows and Chrome browsers. Finally, after doing numerous web searches, I came across a technical support article at TechSmith (Snagit's developer) which acknowledges the issue but offers no immediate solution. Support article is linked here for your reference.

After some research, I realized the issue is somehow related to how Snagit copies images into Windows clipboard. Pasting a Snagit screen capture into MSPAINT and then copying it again into Gmail would work without any problems so a simple interim fix could involve creating a small auxiliary "Converter" program that sits between Snagit and clipboard. The converter app would need to be seamless and require to user input. Luckily, Snagit has a program output feature which is very customization and allows me to execute any 3rd party app and supply it with the captured screenshot. I created a small Windows app in VB.NET with few lines of code that reads an input image file and copies it back into clipboard in a standard format without any user input.

    Sub Main()
'// make sure filename is provided
If My.Application.CommandLineArgs.Count = 0 Then
MsgBox("Please specify an image filename!", MsgBoxStyle.Critical)
End
End If
Try
'// load image file to clipboard
Dim picImage = Image.FromFile(My.Application.CommandLineArgs(0))
My.Computer.Clipboard.SetImage(picImage)
Catch ex As Exception
'// Error out
MsgBox(ex.ToString, MsgBoxStyle.Critical)
End Try
'// All done
End
End Sub

For those who don't want to bother with compiling their own executable, I have compiled a version which be downloaded from here. I called it SnagitGcopy. It's a single EXE file and doesn't require installation. You must have Microsoft .Net Framework installed. If you don't already have it, it can be downloaded from here.

In order to configure Snagit so it can properly copy and paste images into Gmail, Please follow instructions below:

1) Download SnagitGcopy from here and store it in a folder (i.e. C:\GCOPY).



2) Open up Snagit.



3) Under "Profile Settings", Select "Program" as output. This should allow calling our converter program.



4) Then select "Properties".



5) Click on "Add" button.



6) Click on "Open" icon and locate SnagitGcopy executable that you saved in a directory in step 1.



7) Leave the rest as is and click on "OK".



8) Now, we need to change the file name used by Snagit to save screen captures. Click on "Options" under "File name".



9) We should use an static file name to avoid creating a new file each time screen is captured. Put in "gcopy" under "Format" and make sure "Ask before overwriting existing file names" is not checked otherwise you'll be getting an annoying dialog box each time. Click on "OK" to continue.



10) At last change the directory for temporary image file to C:\GCOPY as indicated below. Click on "OK".




You should now be able to copy & paste screen captures directly into Gmail without any issues. If you have setup Snagit to show its Editor after each capture, Make sure "Send" button or [Ctrl+Enter] is pressed otherwise, converter program won't be called:




Here is an example of an images pasted into a message in gmail:



Let me know if you encountered any issues. I would try to get back to you as soon as I can.

Also, please remember that, as always, the usual disclaimers apply. Please backup your system, Save settings, and other common precautions before trying anything new...