Page 1 of 1

Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 2:24 pm
by Markhaen
Hello,

I have an issue with XnView and I don't know if there's a solution to it.

It happens when I open a PNG in Chrome and copy the image (right click). Then I paste it (ctrl+shift+v) in XnView and all the transparency is turned to black.

However I can paste the image in, say, powerpoint and there the transparency is properly handled.

Does any body know a solution for this?

Thanks in advance!

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 2:39 pm
by cday
Markhaen wrote:when I open a PNG in Chrome and copy the image (right click). Then I paste it (ctrl+shift+v) in XnView and all the transparency is turned to black.
I'm no expert on transprency but XnView 'Classic' has this setting you could try:
PNG_Read_Settings.png
... while waiting for further help if needed. :wink:

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 2:44 pm
by Markhaen
Thanks for your help!

However I tried that already and it didn't work. :-)

I just tried again checked and not checked and it didn't help...

Any other idea? :)

Do you guys have the same issue? If you do it with for example this image: https://cdn4.iconfinder.com/data/icons/ ... _2-512.png

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 2:57 pm
by cday
Markhaen wrote:Any other idea? :)
I downloaded your PNG and the 'Alpha' setting below the transparency setting in my sreenshot above has an effect, could you try that?

In the View menu you also have 'Use alpha channel' which I have enabled, although it's greyed out with your image open...

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 3:24 pm
by Markhaen
I tried again with "Compose image with alpha (32 bits)" and it does exactly the same. :-(

For me too the 'Use alpha channel' is selected but greyed out...

So you did your test by copying from a chrome tab? I just tried with Internet Explorer and it gives me something similar (although slightly different, but still black background).

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 3:35 pm
by cday
I opened the PNG file you uploaded and tried various settings; I've since opened the file in XnView again (with both of the above settings unselected) and selecting View > Use alpha channel on and off changes the background (displayed striped) from black to grey (on my computer).

If exploring those settings doesn't produce the result you expect, I'm afraid you'll have to wait for the forum's transparency (and alpha) expert...

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 3:43 pm
by Markhaen
Yeah but what I mean is that if I download the PNG and then open it in XnView it works fine.

My issue is only when copying the image directly from chrome. I have read some things about the clipboard not properly storing the alpha information or I don't know what. But Powerpoint seems to handle that properly though. So XnView should be able too (as it's the best image tool ever :-) ).

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 3:49 pm
by cday
I don't use chrome so that's not a test I can easily do, sorry if there's been some confusion.

But the forum's librarian and transparency (and no doubt alpha) expert may be able to help later...

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 5:30 pm
by XnTriq
cday wrote:But the forum's librarian and transparency (and no doubt alpha) expert may be able to help later...
Expert schmeckspert ;-) :P

This seems to be a known issue with Chrome:
Perhaps adding ClipboardNewMethod=0 to the [Start] section of xnview.ini will make a difference. ImportFormat presumably only works with XnView's own capture command.
XnView Wiki (UI-less Settings » [url=http://www.xnview.com/wiki/index.php/UI-less_Settings#Capture]Capture[/url]) wrote:
ImportFormat
  • Changes the clipboard format when pasting images from the clipboard or capturing images with the capture tool.
    Value: Integer, 0 => CF_BITMAP & CF_DIB, 1 => CF_DIB & CF_BITMAP
Unfortunately, I can't do test with Chrome myself. :-|

Related topics:

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 6:28 pm
by Markhaen
Thanks a lot for your thorough investigation!

I tried the ClipboardNewMethod=0 but it didn't change anything.

It seems to be a general issue indeed. However I experience this with Internet Explorer 11 too. And some applications (like MS office and paint.net) handle transparency correctly, so it's possible...

Anyway I will find other workarounds then.

Thanks again for your help anyway. ;-)

Re: Copy paste PNG from chrome give black background

Posted: Sun Aug 23, 2015 9:30 pm
by XnTriq
BTW: Welcome to the forum, Markhaen :-)
Markhaen wrote:However I experience this with Internet Explorer 11 too.
Oddly enough, it works with IE8 on XP :?
Out of curiosity, I've done some testing with Mozilla Firefox…
[url=http://newsgroup.xnview.com/viewtopic.php?p=121016#p121016]Clipboard Format Spy[/url] ([url=http://cdn4.iconfinder.com/data/icons/medical-website-kit/600/Icon_2-512.png][color=green]Icon_2-512.png[/color][/url]) wrote:

Code: Select all

Code | Description                   |      Size
-----+-------------------------------+----------
0002 | CF_BITMAP                     |         -
0008 | CF_DIB                        | 1.048.616
0011 | CF_DIBV5                      | 1.048.700
C009 | DataObject                    |         4
C013 | Ole Private Data              |       152
C134 | application/x-moz-nativeimage |         -
… and the following xnview.ini:

Code: Select all

[Cache]
IsActive=0
SavingMode=1

[Capture]
ImportFormat=0/1

[Start]
ClipboardNewMethod=0/1
ParamsSavingMode=1
SavingMode=1
Results:
  • ImportFormat=0 + ClipboardNewMethod=0 and
    ImportFormat=0 + ClipboardNewMethod=1:
    transparency is lost
  • ImportFormat=1 + ClipboardNewMethod=0:
    transparency is lost & pHYs chunk is added
  • ImportFormat=1 + ClipboardNewMethod=1 (default):
    alpha channel is preserved & pHYs chunk is added
(pHYs chunk = physical pixel dimensions = 120.0×120.0 dpi)

Re: Copy paste PNG from chrome give black background

Posted: Mon Aug 24, 2015 6:56 pm
by Markhaen
Thanks XnTriq. :)

I tried again with ImportFormat=1 + ClipboardNewMethod=1 but it doesn't change anything.

I give up... :-)

Re: Copy paste PNG from chrome give black background

Posted: Mon Aug 24, 2015 7:30 pm
by XnTriq
Thank you for reporting back!
Markhaen wrote:I tried again with ImportFormat=1 + ClipboardNewMethod=1 but it doesn't change anything.

I give up... :-)
Yeah, I'm at my whit's end here, too :x
However, I don't think it's necessarily XnView's fault as I've seen too many clipboard incompatibilities between graphics applications during my tests. I'm wondering if something like “paste special” would be the solution…

See aslo: “Copy image data” loses transparency

Re: Copy paste PNG from chrome give black background

Posted: Mon Aug 24, 2015 9:54 pm
by uRsti11anError

Code: Select all

[Start]
ClipboardNewMethod=0/1
Is this option absent in Options GUI?

Re: Copy paste PNG from chrome give black background

Posted: Mon Aug 24, 2015 10:00 pm
by XnTriq
uRsti11anError wrote:Is this option absent in Options GUI?
Yes.
XnView Wiki (UI-less Settings » [url=http://www.xnview.com/wiki/index.php?title=UI-less_Settings#Start]Start[/url]) wrote:
ClipboardNewMethod