3

From Finder, how can I copy an image (in an image file, e.g., *.jpg, *.png) directly to the clipboard?
(as opposed to, e.g., opening the file in Finder and then command + c to copy it to the clipboard)

0

3 Answers 3

4

After comments - it appears this may be a joint functionality of both the sending & receiving app.
Selecting the file only, then copy, will then correctly paste the image into Photoshop or Preview using the "New from Clipboard" in each case.
Pasting to Mail also works.

I initially didn't think this was possible, as Finder is not concerned at all with the contents of any file. If you copy, it will copy 'the file' as an entity, ready to paste elsewhere. To get the actual pictorial contents into the clipboard, you need an app that can first decode the file as an image, then specifically export its own clipboard when backgrounded - Preview is one such app

[It's looking more like the Finder copies this, but doesn't tell the user if they just look at the Show Clipboard window from Finder.]

…then I realised Quicklook incorporates the same functionality, so..

Select image file in Finder
Tap Spacebar to open in Quicklook.
Copy Cmd ⌘ C
Switch to whichever app you need to paste the image.
Paste Cmd ⌘ V

10
  • 2
    FWIW... In macOS Catalina, simply selecting the image file and pressing ⌘C then switch to the application to paste the image using ⌘V works without having to do anytime else. Note however, I've only tired this with built-in and Apple applications. Some third-party applications may require an intermediate step. --- Just tried in in LibreOffice and it works too. Jul 5, 2021 at 15:53
  • Now that is interesting. It works to Photoshop too, in Mojave. I really never knew that.
    – Tetsujin
    Jul 5, 2021 at 15:55
  • Also, programmatically querying the clipboard after a ⌘C on a image file it clearly shows an image object which can be used separate and apart from pasting the image file as a file elsewhere in the file system. So it's there and if the receiving application has the ability, it obviously can take it as as image. (+1 for the QuickLook trick.) Jul 5, 2021 at 16:06
  • mhm - the standard Finder 'show clipboard' shows only the file name… which isn't too useful :\
    – Tetsujin
    Jul 5, 2021 at 16:08
  • 1
    After further examination, pressing ⌘C from the QuickLook window, places the exact same content on the clipboard as just Finder vs. e.g. opening the image file in Preview and copying it. So while Finder makes it available on the clipboard as both an image and a file, it is completely up to the receiving application how it's going to handle what's on the clipboard and QuickLook is actually not a factor in this. (I'll leave the +1 anyway.) Jul 5, 2021 at 16:45
1

How to copy image directly from Finder to the clipboard? (instead of opening with Preview)

Since using just ⌘C on the selected image file in Finder does not make the contents of the image file available to all applications to paste into, the Automator Service/Quick Action offered herein will work for those applications that it has to be just the content of the image file on the clipboard.

This adds a keyboard shortcut to Finder to place just the content of the selected image file on the clipboard, ready to paste into an application that supports pasting of the content of an image file when just ⌘C does not work. This of course also works for applications that support ⌘C.

Here is an example Automator Service/Quick Action used in Finder and assigned a keyboard shortcut in System Preferences > Keyboard > Shortcuts > Services of ⌃⌘C that explicitly places the content of the image file to the clipboard, just as if opened in Preview and copied to the clipboard from there.

The example AppleScript code, shown below, was tested in Script Editor and as an Automator workflow saved as a Quick Action under macOS Catalina with Language & Region settings in System Preferences set to English (US) — Primary and worked for me without issue1.

  • 1 Assumes necessary and appropriate settings in System Preferences > Security & Privacy > Privacy have been set/addressed as needed.

Create an Automator workflow as a Quick Action with settings Workflow receives [image files] in [Finder] and add a Run AppleScript action, replacing the default code with the example AppleScript code:


Example AppleScript code:

property BMP : «class BMP »
property PNG : «class PNGf»
property GIF : GIF picture
property HEIC : TIFF picture
property JPG : JPEG picture
property TIFF : TIFF picture

set the clipboard to ""

tell application "Finder"
    set selectedImageFile to ¬
        item 1 of (selection as alias list)
    set nameExtension to ¬
        name extension of selectedImageFile
end tell

if nameExtension is "bmp" then
    set fileType to BMP
else if nameExtension is "png" then
    set fileType to PNG
else if nameExtension is "gif" then
    set fileType to GIF
else if nameExtension is "heic" then
    set fileType to TIFF
else if nameExtension is "jpg" then
    set fileType to JPG
else if nameExtension is "jpeg" then
    set fileType to JPG
else if nameExtension is "tiff" then
    set fileType to TIFF
else
    set msg to "This Automator Quick Action is not currently " & ¬
        "configured to handle the selected image file type."
    display dialog msg buttons {"OK"} default button 1 ¬
        with icon 2 giving up after 5
    return
end if

set the clipboard to (read selectedImageFile as fileType)

Notes:

The example AppleScript code can be expanded to handle additional image file types as needed. To ascertain the correct class to set a property XYZ : ... for, copy the opened image file to the clipboard, from e.g. Preview, and then in Script Editor run clipboard info and the first class it returns is what I'd use to extend the example AppleScript code adding a new else if ... statement to the current if statement block.

It will most likely be TIFF picture, however if this class is shown regardless of where in the list returned it is, it can be used as it will be of the highest quality class of what's offered for the copied opened image file.


enter image description here



Note: The example AppleScript code is just that and sans any included error handling does not contain any additional error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5, with the value of the delay set appropriately.

0

Try macOS Finder Quick Action > Copy Image Down this app. then config inside finder's extension

https://apps.apple.com/us/app/id1663442012

it support batch copy images file to clipboard not only the filename. Then easy paste to Figma Copy Image to clipboard not filename it also can batch convert images to .webp .avif format

You must log in to answer this question.

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