• Become a Power user Intro to AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Painlessly switch from V1 to V2

Push Image into Clipboard with GDIP library

A friend reached out to me wondering if you could use AutoHotkey to automate copying an image from a file to your clipboard.  I figured you could with either the WIA COM Object or the gdip library.   While I didn’t get the WIA solution working, I did (by borrowing from Sean) put together a solution with GDIP.  Here’s a link to the Notify function

Here’s the code to Shove an Image onto the Clipboard

Here’s the video walking-through my function to Shove an Image onto the Clipboard

The key idea of the video is that you can use an AutoHotkey script to programmatically copy an image to your clipboard and customize it to your preferences.

  • 00:00 💡 You can programmatically copy an image to your clipboard using the GD IP library instead of the WIA library.
  • 00:30 💡 The script requires a specific library, but it can be excluded if already present, and the code was obtained from a post.
  • 00:55 📋 The speaker discusses borrowing code from another user to create a function that uses the notify function.
  • 01:38 💡 The script allows you to easily copy the path of a file in Explorer and paste it without the need for double-clicking and opening the file.
  • 01:59 📋 This AutoHotkey script allows you to push an image into the clipboard and paste it wherever you want.
  • 02:32 💡 The script allows users to save an image to the clipboard and receive a notification when it is successfully saved.
  • 03:08 💡 The script allows you to push an image into the clipboard and control its size, making it convenient to quickly view and use the desired image.
  • 03:36 📋 Customize your AutoHotkey script to your preferences by leveraging existing functions in your library, such as the notify function.


hey someone wrote me this morning have asked if there was a way to programmatically copy a image to your clipboard so I just did a little googling and found using the GD IP library I thought I could use the WIA which the windows image acquisition library butit doesn’t seem like there’s a way to do that at least not front shoving it into your clipboard you know so I use the GD IP library I found a post so first off make sure you have the GD IP library – name g IP underscore all but if you find online i think it
was a tick i think wrote the internal one but just to make sure you have that in your library if it’s in your library don’t actually have to include it but i’m doing in here and so you want to have that in there and then i went and found you can find this post which i’ll put in the links or it’s in here in the code when you go and look at it this is where i grabbed a bunch of this code from so somebody and i forget who it was let’s take a look at that so we get this right again you know it’s always better to
borrow than to create in my eyes so Sean so this is that this was a user who he’s made amazing stuff over the years unfortunate snot active recently but so I’ve this is where I borrowed his set clipboard data function and then he he demonstrated – here I added a little bit to this because I wanted to use and I used to the notify function which I’ve featured before I’ll try to include a link to that as well so I built my own little function I wrapped everything I took his code but then I wrapped it with a little bit of
using the notify function so here we have the path to the file right so this would be a static path or maybe you highlight it where you could have let’s see if you had the path on Explorer you could highlight that and hit the button and they would read the Explorer path to the file shove it in the clipboard if that’s the route you want to go that would save you from double-clicking an opening and copying it them you know then being able to paste it depends how you’re gonna use it right this is great
thing about AutoHotkey and here we’re just gonna shove that path into this function does if it’s set to zero I’m going to save this and reload it now when I run it it doesn’t look like anything happened right even though let me let me first let me copy this so right now the word we loads on my clipboard now I’m gonna hit myHotkey and now when I hit paste here is this image so I can zoom out so that was that is that file right this is my son and I who get ready for mother’s day unions so
that’s cool but you know what it’s it to me I don’t like to I guess once you try something it’s nice but I like having a little notification so let me go ahead and nothing that matters I’ll delete this but I’ve built this in here where if I put it to a one save it reload it now when I run it watch the bottom right corner of my screen so it says image on clipboard right and then of course you can change whatever you want this is where I’m writing that so that will just show you hey you know what now it’s
there now you can go hit paste and of course I can still hit paste here and in there it is but if you put a two this is the one I I like and I don’t like the problem is you know watch what I do it so it shoves the image in there but it doesn’t allow you even though there are settings in the notify function for controlling the size of the image they there for whatever reason not working and it to me is just not that important so I’m not going to dig into it and figure out why it’s not working but it
would be cool if I could have live into that in the size so at least I can have a quick glimpse of like oh hey that’s the witch I wanted great it’s on the clipboard you know go ahead but again the beauty is I wrapped this all in a function so you can easily change at zero one two and you know have it customized to what you want we could have used like a tooltip here or a message box I I probably wouldn’t used a tooltip if I wasn’t getting use that notify function but because that notify functions in my library I use it a lot
and I just love leveraging the functions that are already in my libraryif you’re not using libraries get on them I have a couple of videos on using functions and using a library and in a it’s an amazing functionality excuse the pun to be able to use so hope that helps Anna hanging there Cheers

Comments are closed.