Incorrect image obtained from clipboard.get(“png”)

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 Just make sure there is an image in the clipboard and hit the PASTE button.

Author: Fantashit

1 thought on “Incorrect image obtained from clipboard.get(“png”)

Comments are closed.