Comments (9)
So, the images in question are copy-pasted and have a transparent background. I'm using a workaround now where I explicitly set the background to be white; then things work fine with pasting the image using this extension. So, I guess the problem is how transparent backgrounds are handled? I think using white instead of black for the background color when there is none would make more sense. If this is easy to change, it would be a nice fix. Otherwise, I'm content with my explicitly white instead of transparent background workaround for now.
from vscode-paste-image.
Hello, What operating system do you use?
from vscode-paste-image.
Windows 10. I don't know that it matters, but I copy the images out of a Jupyter notebook. The notebook server is running on an Ubuntu machine, but I access the client from Windows.
from vscode-paste-image.
@kivle Hello friend, do you know why?
In file res/pc.ps1
:
$img = [Windows.Clipboard]::GetImage()
$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0)
It get bitmap from clipboard with Rgb24
mode. Rgb24
it seems without aplha value, so get a black backgroud?
@neighthan Could you run res/pc.ps1
(powershell script) in your Win10, and test with Rgb24
and Rgba64
?
from vscode-paste-image.
Yes, using Rgba64
instead of Rgb24
fixes this issue!
from vscode-paste-image.
Okay, the issue seems a bit more complicated. If I copy + paste an image from a Jupyter notebook, it has the black background unless I use Rgba64
, then it works. But if I paste in an image that I copied from a screenshot tool, using Rgb24
works and Rgba64
gives an empty image. I assume that the screenshot tool is only copying an RGB image to the clipboard instead of RGBA. Thus a proper solution to this would need to determine when to use each of these - any idea how to do that?
Or, if that's difficult, one workaround might be to have two separate commands that can be bound - one which uses Rgb24
for pasting and the other for Rgba64
. Keeping Rgb24
as the default would mean nothing is broken for existing users, and anybody who has RGBA images can then just bind the new command to a different shortcut. One command that's smart about the image encoding would be nicer, but I'd be fine with two commands if that leads to a faster solution.
from vscode-paste-image.
I have no Powershell experience, but I used the lines from your script to get images from the clipboard to test on. For both an image that pastes properly with Rgba64
and for one that doesn't, Powershell has the same $img.Format
(Bgra32
). I tried using Bgra32
instead of Rgba64
, but it also gives a blank image. If Powershell says the format for the two images is the same, I'm not sure what's wrong / how to detect which method to use.
from vscode-paste-image.
Hello, thank you for you research.
I use Rgba64 test in my windows, and it's ok for normal png or png with transparent background.
I publish a new version(1.0.3). You can try it!
from vscode-paste-image.
Hi. I have this issue, copying from Jupyter Lab to MS-Word...
Please, could someone be more clear about how to fix it? I'm not familiar (or better saying, completely ignorant!) with PowerShell operations... how to change RGB24 to RGBA64?
thanks
from vscode-paste-image.
Related Issues (20)
- Quick custom name image paste HOT 1
- I don't get how to use this...
- Export ipynb with the pictures
- customize ${imageSyntaxPrefix}
- How to get the default name to be YYYY-MM-DD_HH-mm-ss_<selected text>
- New line character support for pasteImage.insertPattern
- Could not find any matching file with following pattern: puppet/shared.pp
- encoding image file name HOT 6
- Unable to change the default name (using a format)
- Adjusting image size?
- Use on VSCode for the Web
- Windows paste image is not working on vscode insider, cannot generate image file, but work correctly on normal vscode
- Suggestion: When pasting non-image content, fall back to normal paste command
- Add 'Paste Image' to Context Menu to pick up the base path more easily HOT 1
- [Suggestion]: Add file summary md5 to the file name
- Settings do not apply. HOT 4
- There is not a image in clipboard & can't capture screenshots in markdown
- alt text feature
- If the image has spaces on it, the preview does not works
- Suggestion - file name encoding use dash instead of URL
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-paste-image.