17

How do I copy a picture from a file to the clipboard?

I can just select the file and press ctrl-c. But that wouldn't copy it to clipboard. It'll just be marking it if I want to copy the file somewhere else.

I can open the file in Paint and then change the selection to cover all the picture. I need something simpler.

1
  • What's the reason for wanting to do this? - for context sake
    – Paul C
    Dec 29, 2011 at 14:39

7 Answers 7

5

If you're using Windows 10, the Photos app supports Ctrl+cing the opened photo.

15

Download nircmd and extract it or install it to "C:\nircmd" or a similar location. Within the folder will be 'nircmdc.exe.'

This can be used to copy an image to the clipboard. But, this still isn't quite as easy as you were hoping, so let's make it easier:

Open your registry editor.

Now, if you are unfamiliar with regedit, you may wish to find more help, but I will try to make this as simple as possible. First expand "HKEY_CLASSES_ROOT," then "*," then "Shell." Right-click on "Shell" and select "New->Key." Name this key whatever you want for example, "Copy Image to Clipboard." Now, right-click on this newly created key and once again select "New->Key." This one you will name, "command." On the right side, you will now see a value labeled "(default)". Double-click this item and under "Value Data:" put,

C:\nircmd\nircmdc.exe clipboard copyimage "%1"

Quoting the %1 parameter allows this to work with filenames that contain spaces.

Please note if you did not install it the same way as I did this may not be the exact location and you would need to replace "C:\nircmd\nircmdc.exe" with the proper address to that executable file.

Once complete, you will be able to right-click a file and select "Copy Image to Clipboard." From this point forward doing what you need will be just that simple.

5
  • And it works :)
    – user4951
    Jan 1, 2012 at 13:08
  • 1
    @Serodis Why don't you just upload the registry exported file which contains patch to the setting need to make (so as to have the context menu available)?
    – Nam G VU
    May 3, 2012 at 8:03
  • @Serodis I do the same thing, but I cannot get it works for me on Windows 7 64bit 's Windows Explorer. But I can call it from command line by C:\nircmd\nircmdc.exe clipboard copyimage {path to my image}. Would you have any idea for me?
    – Nam G VU
    May 3, 2012 at 8:35
  • This does not preserve png transparency. Any solution that does?
    – Mark
    Nov 21, 2015 at 22:20
  • Thanks, this helped me a lot. Works like a charm! One small correction though. When you wrote This one you will name, "command." I think you meant to write This one you will name, "command". Aug 1, 2017 at 18:27
3

You can use Nircmd.

nircmd clipboard copyimage sourcefile

3

In addition to the nircmd solution I tried the same approach with PowerShell to avoid 3rd party software with answers from this question.

It is slower and also a PowerShell window is visible. The "hidden" option makes it acceptable.

The "Extended" makes it available in the extended context menu (Shift+Right Click).

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Copy Image to Clipboard]
"Extended"=""

[HKEY_CLASSES_ROOT\*\shell\Copy Image to Clipboard\command]
@="powershell.exe -windowstyle hidden -Command \"Add-Type -AssemblyName System.Windows.Forms; [Windows.Forms.Clipboard]::SetImage($([System.Drawing.Image]::Fromfile(\\\"%1\\\")))\""

Save as CopyImageToClipboard.reg and apply.

I do not have enough reputation for adding a comment and hope this qualifies for a separate answer.

1

Nircmd seems to be the way to go, but for those of us that can't freely install software (even freeware!) on their workstation computers, use Microsoft Paint:

From Windows Explorer, right click the file. The context menu option "Edit" will open the image in the Paint application by default (installed applications such as Adobe Photoshop will be used instead).

You can also open the image in Paint by using the "Open With..." option.

Once open in Microsoft Paint, select all and copy (Ctrl+A, Ctrl+C).


This does not involve taking an extraneous screenshot of the image (so long as it's not a proprietary format that Microsoft Paint can't open, in which case you'd probably want to copy the pixels in the proprietary application that opens such files).

This also strips any metadata that applications may inject to the image, so you get the plain pixel bitmap data in clipboard.

Similarly, use GreenShot to open the image file and click the "Copy to Clipboard" icon.

1
  • this is a very good answer as it requires no extra installation of tools or programs. Nov 3, 2017 at 11:51
0

I found ClipSa on google, not tried it yet.

Not found anything to do the opposite yet though

1
  • 1
    ClipSa is reverted way of the OP(original post), ie. from clipboard to file. What needed is to copy the image in the file to clipboard.
    – Nam G VU
    May 3, 2012 at 8:04
-2
  1. Press "print screen"
  2. Now open Paint. ( It is under accessories ).
  3. Press Ctrl + V

Alternatively you can try an Open source software called "Green shot" ( http://getgreenshot.org/ ), it has additional feature - capture region of the screen. If that is what you are looking for. Another advantage of this free utility - It has a editor which is built in.

3
  • This will still require you to open the file and create a screen shot, which means that the original resolution of the file will be lost (e.g. open a picture at a size larger than your actual desktop resolution).
    – slhck
    Dec 29, 2011 at 10:05
  • No no no. Not from screen to clipboard. From file to clipboard.
    – user4951
    Dec 29, 2011 at 10:05
  • @JimThio It is a cool question, but isnt that what the grafics programs are for :-) It is almost as if you (and others) have hundreds of great ways to really "change" the OS itself. Why arent you the ones working at Microsoft? A clipboard manager with a context menu, that drops any "file" into the clipboard, Genious!
    – Psycogeek
    Dec 29, 2011 at 10:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .