Nw.js: Incorrect image obtained from clipboard.get("png")

Created on 3 Jan 2018  路  11Comments  路  Source: nwjs/nw.js

NWJS Version : v0.27.3 SDK
Operating System : Windows 10

Expected behavior

To be able to create the correct image from the data obtained from calling clipboard.get("png")

Actual behavior

The image created is only correct in size, the content is all messed up.

How to reproduce

1) Make sure there is an image in the system clipboard.

2) In the javascript of an app get the clipboard object with nw.Clipboard.get()

3) Get the image data with clipboard.get("png")

4) Use the result of the previous call to populate an Image object

5) When that is complete, append the image to the body of the document. The drawn image is wrong.

Note: This works fine when requesting a "jpeg" from the clipboard.

Here is a basic app demonstrating the problem example-app.zip. Just make sure there is an image in the clipboard and hit the PASTE button.

P2 bug triaged

Most helpful comment

This is fixed in git and will be available in the next nightly build.

All 11 comments

FWIW, tried the test app on High Sierra (10.13.2) and it failed with a png or jpg on the clipboard -

fail
Seems to fail from at least 0.25.5 onwards - 0.24.5 is OK.

I can reproduce this issue on Windows and Linux with nwjs-sdk-v0.27.3.
image

I can't reproduce the jpeg case. Please give more information on this, e.g. the sample image.

Yup, here is the image - just tried with 0.27.4 and still fails. (note: iMac is Retina 5K 18,3)
Also tried on Yosemite (10.10.5) non-retina and still fails with 0.27.4-sdk.

01

Cheers.

@Blatman thanks. but it works for me. How did you put it into clipboard? I opened this issue page with Safari, right click on the image and click 'copy image'.

@Blatman did you mean you are using a jpeg image or you are using 'jpeg' format parameter in the source code in index.html?

To clarify, when I said

This works fine when requesting a "jpeg" from the clipboard.

I meant it worked when using the "jpeg" paramenter when making a call to clipboard.get in the source code.

Whoops - sorry my mistake - code is set up expecting png and I used the jpg so it will fail - sorry for wasting time.

@Blatman no problem and good to know it :) and thanks for help testing NW.

btw, the source format shouldn't matter, it will be converted to the format requested.

This is fixed in git and will be available in the next nightly build.

Was this page helpful?
0 / 5 - 0 ratings