Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect image obtained from clipboard.get("png") #6366

Closed
DiegoScirra opened this issue Jan 3, 2018 · 11 comments
Closed

Incorrect image obtained from clipboard.get("png") #6366

DiegoScirra opened this issue Jan 3, 2018 · 11 comments
Assignees

Comments

@DiegoScirra
Copy link

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.

@Blatman
Copy link

Blatman commented Jan 3, 2018

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.

@Christywl
Copy link
Contributor

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

@rogerwang
Copy link
Member

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

@Blatman
Copy link

Blatman commented Jan 4, 2018

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.

@rogerwang
Copy link
Member

@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'.

@rogerwang
Copy link
Member

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

@DiegoScirra
Copy link
Author

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.

@Blatman
Copy link

Blatman commented Jan 4, 2018

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

@rogerwang
Copy link
Member

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

@rogerwang
Copy link
Member

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

@rogerwang
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants