Giter Club home page Giter Club logo

Comments (5)

mushanshitiancai avatar mushanshitiancai commented on June 7, 2024 1

Very very thank you for you experiment!

I update plugin, fix this bug and enhance the log system. You can try it.

from vscode-paste-image.

mushanshitiancai avatar mushanshitiancai commented on June 7, 2024

Hello, I try it in my windows 10, and it's ok

from vscode-paste-image.

mushanshitiancai avatar mushanshitiancai commented on June 7, 2024

You can do a test. First save this powershell script to a file named "ps.pc1":

param($imagePath)

# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1

Add-Type -Assembly PresentationCore
$img = [Windows.Clipboard]::GetImage()

if ($img -eq $null) {
    "no image"
    Exit 1
}

if (-not $imagePath) {
    "no image"
    Exit 1
}

$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0)
$stream = [IO.File]::Open($imagePath, "OpenOrCreate")
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($fcb)) | out-null
$encoder.Save($stream) | out-null
$stream.Dispose() | out-null

$imagePath

And then you copy a image, open a powershell window, run this script: powershell -f ps.pc1 "D:\\test.png", observe the output.

from vscode-paste-image.

elbehery95 avatar elbehery95 commented on June 7, 2024

image

It just prints out the argument given. And image is created at the given location

from vscode-paste-image.

elbehery95 avatar elbehery95 commented on June 7, 2024

I have found the issue;

image

It turns out that if powershell is not added into the system environmental variables the code required for paste will throw an exception since it is not able to launch the powershell script

image

I am doing a pull request to fix this issue. Adding the full powershell path into the variable powershell should fix this problem in case users dont have powershell.exe added to system env. vars

image

from vscode-paste-image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.