How to copy picture from a file to clipboard

14,697

Solution 1

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

Solution 2

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.

Solution 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.

Solution 4

You can use Nircmd.

nircmd clipboard copyimage sourcefile

Solution 5

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.

Share:
14,697

Related videos on Youtube

user4951
Author by

user4951

Updated on September 18, 2022

Comments

  • user4951
    user4951 over 1 year

    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.

    • Admin
      Admin over 12 years
      What's the reason for wanting to do this? - for context sake
  • slhck
    slhck over 12 years
    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).
  • user4951
    user4951 over 12 years
    No no no. Not from screen to clipboard. From file to clipboard.
  • Psycogeek
    Psycogeek over 12 years
    @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!
  • user4951
    user4951 over 12 years
    And it works :)
  • Nam G VU
    Nam G VU almost 12 years
    @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
    Nam G VU almost 12 years
    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
    Nam G VU almost 12 years
    @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?
  • Mark
    Mark over 8 years
    This does not preserve png transparency. Any solution that does?
  • macdonaldtomw
    macdonaldtomw over 6 years
    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".
  • Adam.at.Epsilon
    Adam.at.Epsilon over 6 years
    this is a very good answer as it requires no extra installation of tools or programs.