Copy paste PNG from chrome give black background

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

Moderators: XnTriq, xnview

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

Copy paste PNG from chrome give black background

Postby Markhaen » Sun Aug 23, 2015 2:24 pm

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: 1575
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Copy paste PNG from chrome give black background

Postby cday » Sun Aug 23, 2015 2:39 pm

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:

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

Re: Copy paste PNG from chrome give black background

Postby Markhaen » Sun Aug 23, 2015 2:44 pm

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: 1575
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Copy paste PNG from chrome give black background

Postby cday » Sun Aug 23, 2015 2:57 pm

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

Postby Markhaen » Sun Aug 23, 2015 3:24 pm

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: 1575
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Copy paste PNG from chrome give black background

Postby cday » Sun Aug 23, 2015 3:35 pm

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

Postby Markhaen » Sun Aug 23, 2015 3:43 pm

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: 1575
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Copy paste PNG from chrome give black background

Postby cday » Sun Aug 23, 2015 3:49 pm

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: 5104
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Copy paste PNG from chrome give black background

Postby XnTriq » Sun Aug 23, 2015 5:30 pm

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 » Capture) 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

Postby Markhaen » Sun Aug 23, 2015 6:28 pm

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: 5104
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Copy paste PNG from chrome give black background

Postby XnTriq » Sun Aug 23, 2015 9:30 pm

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…

Clipboard Format Spy (Icon_2-512.png) 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

Postby Markhaen » Mon Aug 24, 2015 6:56 pm

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: 5104
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Copy paste PNG from chrome give black background

Postby XnTriq » Mon Aug 24, 2015 7:30 pm

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

Postby uRsti11anError » Mon Aug 24, 2015 9:54 pm

Code: Select all

[Start]
ClipboardNewMethod=0/1

Is this option absent in Options GUI?

User avatar
XnTriq
Moderator & Librarian
Posts: 5104
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Copy paste PNG from chrome give black background

Postby XnTriq » Mon Aug 24, 2015 10:00 pm

uRsti11anError wrote:Is this option absent in Options GUI?

Yes.

XnView Wiki (UI-less Settings » Start) wrote:
ClipboardNewMethod


Return to “Classic - General Support”

Who is online

Users browsing this forum: No registered users and 1 guest