Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Why is it that when I copy/paste PNG files with a transparent background into photoshop that they show up with a black background, whereas if I save them, then open they're transparent?

I find it unlikely that the alpha channel would be omitted when copying.

share|improve this question
    
Where are you copying from? –  Bob Jul 7 '12 at 19:20
    
    
@techie007 I wouldn't consider this a duplicate because he is asking WHY it does it - he already knows how to save it and keep the transparency. –  ekaj Jul 7 '12 at 20:03
    
@ekaj True, but I'm not sure "Why" is answerable. Especially without (currently) knowing his OS. –  Ƭᴇcʜιᴇ007 Jul 7 '12 at 20:31
1  
> I'm not sure "Why" is answerable @techie007, sure it is; I just did it. –  Synetech Jul 7 '12 at 20:54

2 Answers 2

up vote 1 down vote accepted

Why is it that when I copy/paste PNG files with a transparent background into photoshop that they show up with a black background, whereas if I save them, then open they're transparent? I find it unlikely that the alpha channel would be omitted when copying.

Abstract

Copying and pasting has two parts: the source and the destination. What happens when you copy and paste depends on both sides.

Copying PNGs/Transparent images

When you copy a PNG, you can do so in more than one way.

You can copy the actual .png file, in which case the filename and path of the file is copied to the clipboard. In this case, when you paste, the receiving program must be able to understand this particular clipboard format and open the filename contained therein. In that case, it should be no different than using the File->Open command.

If on the other hand, you have the picture open in an editor/viewer and copy the picture’s actual pixels, then it depends on editor/viewer:

  • If it only copies the color data, then the receiving program will only display whatever the color data contains, which in the case of images with transparency could contain black or another color in the transparent areas.

  • If the editor/viewer copies only the rendered pixels, then the receiving program will paste the final image with the transparent areas showing whatever the background color in the editor/viewer happened to be set to when you copied.

  • If the editor/viewer copied the color data as well as the transparency data, then the receiving program will paste the image as expected, with the correct transparency.

You can see this in action when using an icon editor. Depending on the programs you use, if you copy an icon that has transparency to another program like MSPaint, it may end up with unexpected results in the transparent areas.

Clipboard Formats

The problem is that there are only a few standard clipboard formats including text, files, and bitmap data. For any custom data that is to be copied, the program must register it and copy its data to the clipboard. In that case, it is up to the receiving program to be able to know of the custom format and be able to decode it. The standard bitmap format is for flat images and has no concept of transparency (it was designed a long time ago). As such, programs have to provide transparent images to the clipboard in a custom format, and while there are some that are common, there is no single, standard format. Some programs will only copy the image to the flat-bitmap format which of course means no transparency information.

Silver Lining

On the bright side, a program may place multiple items in the clipboard (of different format), so if an editor/viewer is extra smart, it will place a copy of the data (in this case a transparent image) in multiple formats, and then it is up to the receiving program to use the best version with the most information.

For example, when you copy files or folders, they are copied in no less than four formats in XP, and more in 7 (there are some other data copied as well, but I mean the actual filenames/paths). Some of them are more useful because they include lost of data about the copied files, while some are much more simple and include just the name in plain-text of the first file.

The same goes for copying transparent images. A program can place a simple, flat, rendered image in the bitmap format of the clipboard, can include the transparency information in a custom transparency format, and a raw copy of the image with all of its data including transparency, layers, etc. in another custom format.

Of course, like I said, it is then up to the receiving to be able to understand and use the best version, otherwise it may end up using the simple, old-fashioned, backward-compatible, standard copy.

share|improve this answer

There must be a rendering process to show something through the transparent parts of a png. When you copy the image, only the end result of that rendering process is sent to the clipboard as (0,0,0) RGB, or black.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.