Blog du Tristank

So terrific that 3 of 4 readers rated it "soporific"

PasteOff: Clipboard-To-Image-File Utility

PasteOff: Clipboard-To-Image-File Utility

  • Comments 13
  • Likes

PasteOff

Strange New Disturbance

I've been testing PjPic, and it addresses many deficiencies of PasteOff (multi-profile!). If you like PasteOff, you might like PjPic more. Or as well!

Fiddling: PasteOff Image Saving Thing

As I mentioned in my post about MSN Spaces, I've got this weird habit of wanting to save and convert clipboard bitmaps (most often, OneNote screen clippings, which you take by right-clicking the OneNote tray icon) into JPGs or PNGs directly, with a minimum of actual effort expended.

So, I hacked together a little applet that converts any bitmap on the clipboard to a JPG, PNG, TIFF or BMP file in a configurable folder (configurable), and can optionally run a command against the saved file. You don't need to worry about naming if you don't want to.

I call the project PasteOff (say it with a Sean Connery accent).

Disclaimer: You assume any and all risks with using this software - it's unsupported, largely untested, and isn't production quality. It's software I developed for my personal use, and may not be fit for any particular purpose other than my own personal use.

Download:  Latest Version  (0.8) , 13KB
.Net Framework 1.1 is required (get it from WindowsUpdate).

Installation: Unzip to wherever you want it. Then create your own shortcut to run it, or just run it directly. Simple, eh?

Configuration is stored in C:\Documents and Settings\Username\Application Data\PasteOff\config.bin .

Using PasteOff

It's all run from a notification-not-system-tray Icon. This will be called "the icon" to avoid me having to type "notification" a lot.

Icon with image on Clipboard:     With no image on Clipboard:  

The icon doesn't self-refresh, it only refreshes when you do something with it (like click it). Right-Click the icon for actions and Configuration options:

Typical usage works like this:

  1. Get your source image onto the clipboard with Ctrl-C, OneNote screen clipping, PrtScn, heck, any Copy will do.
  2. (optional) If you left-click the icon once, it should change colour to indicate an image is now on the clipboard. You don't need to do this before doing anything else, it's just a handy way of telling whether something's there.
    • I just discovered that OneNote actually puts the image on the clipboard for you while taking a screen clipping, so thanks OneNote for saving an extra Ctrl-C. So, for me, step 1 is just Right-click the OneNote icon, choose Create Screen Clipping, select desired screen area.
  3. If you want to type a descriptive name for the file, double-click the icon to bring up the preview window (there's also a context menu item for this). The extension is automatically supplied.
    • Obviously illegal characters are removed or replaced, but it's not a competition to break it, okay?
  4. Otherwise, if you just want a random-ish name, right-click the tray icon and choose Save Directly. The file will be saved directly to the target folder, with a temp file name provided by Windows - usually something like TMP43a.jpg.
  5. If you've specified an application to run after saving and the save is successful, the custom app you specify is run against the file (including path) that was produced.
  6. Depending on your clipboard options, you can put the local path and filename, some custom text or nothing at all on the clipboard afterwards.
    • I use the custom text option: <img src="http://www.example.com/%s"> so that I'm ready to post the image link directly into some blog HTML in .Text.

Notes:

  • The preview window tiles images, there's no scroll bar, and images tend to linger even after being invalidated. I don't really mind.
  • If nothing seems to be happening when you Do Things, the icon's probably gone "blue" (eg, image is gone, text or some other non-image object is on the clipboard).
  • OneNote seems to store notes on the clipboard as images too! So you can make a JPG of note text, not that you'd usually want to...

Don't forget to use the clipboard text (if you need to) before copying the next image to the clipboard.

On the cards for When I Feel Like It:

If there's a bracketed version number in front of the feature, it first appeared in that version.

  • (0.5) Support for target folders other than My Pictures as a target! (very likely, very soon).
  • (0.5) Optionally run a batch file on the output. Makes my MSDN blog stuff easier if I do that...
  • (0.5) Optional Prompt Before Overwrite.
  • (0.6) Other image formats (Thanks for the suggestion Mischa)  now PNG, JPG, BMP and TIF can be done. 
  • Support for multiple "save profiles", with different commands for each. Maybe. It kinda seems like the "20" part of 80/20.
  • (0.7) I'm sure there's a reason you might not want the clipboard contents overwritten with the end filename. So perhaps turning it off might be an option. Sometime.
  • (0.7) Allowing user to specify the string they want on the clipboard
  • (0.8) Disable running a command directly from the tray menu \
  • Memory optimization - 0.8 is ~12MB from boot.
  • A little more robustness/user friendliness. Can't hurt. Can it?
  • Optional re-numbering on attempted overwrite.
  • Base filename support (eg, all images are IMAGE000n or whatever).
  • Log/history/something. Maybe.
  • Preview window improvements. Maybe.

 

Comments
  • PasteOff is back, bigger, stronger and with more error handling. OK, barely more error handling. It's a fun project, not a production one, mmkay?

    PasteOff is a quick'n'dirty utility that saves images from the clipboard to a pre-arranged location in JPEG format, with a randomly generated filename (or one you specify), and can run a utility/script against the saved image afterwards.

  • I am currently working on a project where I have the need to convert screenshots to jpg's programatically in C# and I was wondering if you are willing to share some of the source code to do this (since you seem to have already solved this problem). I have found that your "quick and dirty" app actually works pretty well. Any help is appreciated. Thanks.

  • I'll post some of the relevant bits a bit later on.

    Coming clean, the core functionality is straight copy-and-paste from the MSDN Library examples - it's just building a UI around it that's challenging :)

  • Hey, I fond PasteOff by searching Google for "paste from clipboard as image file" and it does exactly what I was looking for! It is the only utility I found that simply does just that. Thanks! You should consider making it a "production" project

  • Tristan now likes Class Diagrams.

  • On steroids, that is, without the shrivelled um&amp;#8230; equipment and rage issues!
    PjPic could be called a spiritual sequel to PasteOff, in much the same way that other spiritual sequels bear little resemblance of their alleged parents.
    It&amp;#8217;s