vscode-paste-image icon indicating copy to clipboard operation
vscode-paste-image copied to clipboard

Images pasted are all blank (bug since 1.0.3)

Open walterlv opened this issue 6 years ago • 11 comments

Description

When pasting an image into Visual Studio Code markdown file, the image will be completely blank with every pixel transparent.

How to reproduce it?

  1. Copy an image into the clipboard;
  2. Press Ctrl+Alt+V and wait for the insertion of the image.

What's the environment?

  • OS: Windows 10 Pro Insider Preview 18290.1000
  • Extension: 1.0.3 (Notice that 1.0.2 does not reproduce this issue)

What happened?

You can see that the image pasted is transparent.

image

And to reveal it in the explorer, it is also transparent.

image

But actually, it can be pasted into other applications such as what I'm writing on GitHub issues.

walterlv avatar Dec 14 '18 13:12 walterlv

描述

在 Visual Studio Code 里使用此插件粘贴的任何图片都是空白的,所有像素都是透明像素。

复现步骤

  1. 复制一张图片到剪贴板;
  2. 在 Visual Studio Code 里用 Ctrl+Alt+V 粘贴。

环境

  • 操作系统:Windows 10 Pro Insider Preview 18290.1000
  • 插件版本:1.0.3(1.0.2 版本不会复现此问题)

现象

可以看到粘贴进来的图片是透明的。

image

在资源管理器中查看,它也是透明的(实际上粘贴的图片已经损坏不可恢复)。

image

但是在其他应用里面可以粘贴,例如我现在正在编写的 GitHub Issue 窗格中,是可以正常粘贴的。

walterlv avatar Dec 14 '18 13:12 walterlv

The issue appears to be how PowerShell is writing the image file. If you look at the following script: mushan.vscode-paste-image-1.0.3\res\pc.ps1

Line 18:

$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgba64, $null, 0)

It doesn't seem to like the alpha code in 'Rgba64'. I've tried several formats here, but it seems to be the alpha code. Also appears to be a fix from Issue #29. If you just change it back to 'Rgb24', it will work again.

NickSegalle avatar Dec 19 '18 18:12 NickSegalle

This is happening to me today, again, as well. It happened here and I reported it #38. Then went away. Now its back!

image But only every now and then! I'm not sold on the PowerShell fix. I feel like its a timestamp thing.

My workflow:

  • Take screenshot of a Skype meeting screenshare using SnagIt
  • Click "Copy All" in SnagIt
  • Paste into VS Code .md file
  • The image link is pasted into the file and AN image shows up in /assets above the .md directory...
  • BUT the image filename does not have the same timestamp as the filename in SnagIt! image

Please see #38 where I reported the same issue. To fix ( a SERIOUS pain) I had to go into SnagIt and copy the timestamps, then paste them into the image filenames in the /assets folder.

Please consider addressing this issue.

Thank you

SeaDude avatar Jan 07 '19 18:01 SeaDude

I swtich to 1.0.2 , hah..

stanstanwang avatar Jan 08 '19 07:01 stanstanwang

@gaosjx how do you revert to previous version?

SeaDude avatar Jan 09 '19 19:01 SeaDude

hello, can you tell me the screenshots tool that you are using?

I guess some screenshots tool take image with alpha value(Rgba64 work well) and others not(Rgba24 work well).

Does anyone know how to take image from clipboard correctly by powershell?

mushanshitiancai avatar Jan 14 '19 14:01 mushanshitiancai

@SeaDude update the vscode version to 1.30.2 This version has a new feature : Choose extension version - Install earlier versions of Marketplace extensions.

stanstanwang avatar Jan 14 '19 16:01 stanstanwang

@mushanshitiancai , I'm using TechSmith SnagIt. I used this workflow without issue up to 3-4 weeks ago.

@gaosjx , i'm on 1.30.2. I'll try rolling back to earlier version of Paste Image and see if that helps. image d

SeaDude avatar Jan 14 '19 22:01 SeaDude

CONFIRMED: Rolling back to Paste Image 1.0.2 fixed this issue.

SeaDude avatar Jan 14 '19 22:01 SeaDude

@SeaDude @gaosjx @NickSegalle @walterlv Thank you for your attempt!

I try SnagIt and get blank image too, So I rollback the code to 1.0.2 to fix this bug. Now you can update PasteImage to 1.0.4.

mushanshitiancai avatar Jan 23 '19 15:01 mushanshitiancai

@mushanshitiancai 哈!刚刚收到了你的 1.0.4 的更新啦,感谢!

walterlv avatar Jan 23 '19 15:01 walterlv