How to Get a Base64 Variation of a File From Command Line


A while back I composed a short article on how to Convert Image to Data URI with JavaScript It’s a cool technique designers can utilize for any variety of factors. Rather of abusing canvas, nevertheless, why not just get the base64 information from command line?

You can utilize base64 and pbcopy to transform a file to base64 and copy it to the clipboard:

 # base64 gets information, pbcopy copies to clipboard
base64 -i logo.jpeg|pbcopy

As Soon As you have the file information copied in base64 format, the URL format to utilize the information is:

 # information: {mime-type}; base64, {information}
information: image/jpeg; base64,/ 9j/4AAQSkZJRgAB...

While base64 information and information URIs do look puzzling, they work to prevent making demands to other files. I utilize them when producing discussions or when I can’t rely on a good web connection.

  • WebKit-Specific Style:  -webkit-appearance

    I was just recently scoping out the ghastly source code of the Google homepage when I saw the “Google Browse” and “I’m Feeling Fortunate” buttons had a design meaning I had not seen prior to:- webkit-appearance. The worth designated to the design was “push-button.” They are buttons so that …

  • Create GitHub-Style Buttons with CSS and jQuery, MooTools, or Dojo JavaScript

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: