Copy paste PNG from chrome give black background

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

Markhaen
Posts: 6
Joined: Sun Aug 23, 2015 2:19 pm

Copy paste PNG from chrome give black background

Post 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!
cday
XnThusiast
Posts: 4169
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Copy paste PNG from chrome give black background

Post 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:
You do not have the required permissions to view the files attached to this post.
Markhaen
Posts: 6
Joined: Sun Aug 23, 2015 2:19 pm

Re: Copy paste PNG from chrome give black background

Post 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
cday
XnThusiast
Posts: 4169
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Copy paste PNG from chrome give black background

Post 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...
Markhaen
Posts: 6
Joined: Sun Aug 23, 2015 2:19 pm

Re: Copy paste PNG from chrome give black background

Post 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).
cday
XnThusiast
Posts: 4169
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Copy paste PNG from chrome give black background

Post 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...
Markhaen
Posts: 6
Joined: Sun Aug 23, 2015 2:19 pm

Re: Copy paste PNG from chrome give black background

Post 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 :-) ).
cday
XnThusiast
Posts: 4169
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Copy paste PNG from chrome give black background

Post 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...
User avatar
XnTriq
Moderator & Librarian
Posts: 6386
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Copy paste PNG from chrome give black background

Post 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:
Markhaen
Posts: 6
Joined: Sun Aug 23, 2015 2:19 pm

Re: Copy paste PNG from chrome give black background

Post 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. ;-)
User avatar
XnTriq
Moderator & Librarian
Posts: 6386
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Copy paste PNG from chrome give black background

Post 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)
Markhaen
Posts: 6
Joined: Sun Aug 23, 2015 2:19 pm

Re: Copy paste PNG from chrome give black background

Post by Markhaen »

Thanks XnTriq. :)

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

I give up... :-)
User avatar
XnTriq
Moderator & Librarian
Posts: 6386
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Copy paste PNG from chrome give black background

Post 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
uRsti11anError
Posts: 21
Joined: Thu Aug 06, 2015 5:39 pm

Re: Copy paste PNG from chrome give black background

Post by uRsti11anError »

Code: Select all

[Start]
ClipboardNewMethod=0/1
Is this option absent in Options GUI?
User avatar
XnTriq
Moderator & Librarian
Posts: 6386
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Copy paste PNG from chrome give black background

Post 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