Skip to content

Instantly share code, notes, and snippets.

@davidroberts63
Last active May 19, 2016 15:56
Show Gist options
  • Save davidroberts63/a55cb9bfe9052f523a7410b4a16e56cd to your computer and use it in GitHub Desktop.
Save davidroberts63/a55cb9bfe9052f523a7410b4a16e56cd to your computer and use it in GitHub Desktop.
Converts a file to Base64 encoding. Useful for images you want to use in HTML. Just take the contents of the resulting .b64 file and put it in your image tag or CSS.
$fileName = "C:\Temp\SomeImage.png"
[Convert]::ToBase64String((Get-Content $fileName -Encoding Byte)) | Set-Content ($fileName + ".b64") -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment