Code Monkey home page Code Monkey logo

imageasbase64's Introduction

imageAsBase64

Implementations allowing to convert/use regular image as base64 content

Into

It it started with me wanting to paste an clipboard-stored image as base64 content in markdown documents, so I started to develop an extension for vs code that will allow to do it..

I later realized that it should not be an application-specific feature, like, in this case - VS code feature.. but a system-wide functionality.

We have means of making this functionality in either an AutoHotkey or Powershell or other tool/language of our choice.

Current implementations

1. Powershell global keyboard hook

gif

The script is listening for key-presses. In default implementaion - once pause key press is detected - the script will try to extract the raw image from the clipboard, and, if the image is found - it will set the value of the clipboard to base64 string and execute CTRL+V command to paste the contents into currently active window.

The value will contain a valid markdown image format.

Edit the source code for it to suit your needs.

Referencd in: github

Known problems

  • if you assign a hook to F1 button, then some programs could mess up with the script. For example Chrome will corrupt the automation script.
  • we cannot unfortunatelly use GetAsyncKeyState method. Windows Defender flags the powershell script as a trojan and removes the file.
  • to exit the script you have to press CTRL+C plus any additional button
  • after the image is pasted - clipboard's content will be the latest content set by the script (not much of an issue, but a feature)

imageasbase64's People

Contributors

pavlexander avatar

Stargazers

 avatar

Watchers

 avatar

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.