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 merely 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

When 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 developing discussions or when I can’t depend on a good web connection.

  • From Webcam to Animated GIF: the Secret Behind chat.meatspac.es!
  • I’m an Impostor

    This is the hardest thing I have actually ever needed to compose, much less confess to myself. I have actually composed resignation letters from tasks I have actually enjoyed, I have actually ended relationships, I have actually stopped working at a host of jobs, and let myself down in my life. All of those sensations were extremely …


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: :???: :?: :!: