Alex Aparin
Alex Aparin

Reputation: 4512

How to paste transparent image to photoshop?

Is there any way to paste transparent image to photoshop via clipboard?

I tried to use registered "PNG" format, but it seems like photoshop does not support it (opposite to MSOffice 2007 and GIMP). Usage of CF_DIB does not preserve alpha channel in photoshop.

NOTE: I used WinApi to perform such things

Upvotes: 4

Views: 22389

Answers (4)

bamGFX
bamGFX

Reputation: 19

Unfortunately, Photoshop has yet to assist in the "copy-paste" of pngs from an external source into a page without a black bringing a background. The only way that I know of is to save the file and then open it in Photoshop. From there, a "copy-paste" should work.

Upvotes: 2

Ezhik
Ezhik

Reputation: 171

So I got fed up with this annoyance and made a workaround.

There are two pieces to it:

  • A tiny utility I wrote to save the clipboard image to a .png file
  • An AutoHotKey script

The AutoHotKey script checks if Photoshop is currently active, and if so it intercepts the Ctrl+V key combination, and then it runs the utility.

If the utility saved an image to %TEMP%\clip.png, the Shift+Ctrl+F12 key combination is sent to Photoshop, which I have mapped to a Photoshop Action to place the clip.png file into the currently open document.

If the utility did not save the image, the standard Ctrl+V key combo is sent to Photoshop and a standard paste is performed.

All the source code is available here: https://github.com/SilverEzhik/ClipboardToPNG, and the utility can be downloaded here: https://github.com/SilverEzhik/ClipboardToPNG/releases

To create the Photoshop Action, just make a new action with the key combination mapped to Shift+Ctrl+F12 (or change the combination in the script file), and then while recording, go to File > Place Embedded..., and paste %TEMP%\clip.png in the file name field.

The source code for the AHK script is provided below - if you haven't used AutoHotKey before, install it, then save the code to a filename.ahk file to the same directory as the ClipboardToPNG.exe utility, and then just run it.

DoPhotoshopPaste() {
    RunWait, %A_ScriptDir%\ClipboardToPNG.exe ; run utility, wait for it to complete
    if (ErrorLevel == 0) { ; if error code is 0
        SendEvent, +^{F12} ; press Shift+Ctrl+F12 to run the designated Photoshop action to paste
    }
    else { 
        SendEvent, ^v ; else, just perform a standard paste.
    }
}

#IfWinActive ahk_exe Photoshop.exe ; only activate this hotkey when photoshop is active
    ^v::DoPhotoshopPaste()
#IfWinActive

Upvotes: 5

Durgesh Dangi
Durgesh Dangi

Reputation: 213

open your image in Microsoft paint or other software and save as transparent .png file and after drag and drop in photoshop.

Upvotes: -3

Matt McManis
Matt McManis

Reputation: 4675

You have to save the png or gif image to your computer first, then open it in Photoshop or you'll get a black background.

After saving, you can also drag it from your computer and drop it into the Photoshop project you're working on and it will be transparent on a new layer.

When you do this it may turn into a Smart Object, which will maintain its quality on resize. If you don't want it to be a Smart Object, right click on its layer, choose "Rasterize Layer".

Upvotes: 0

Related Questions