Skip to content

Instantly share code, notes, and snippets.

@JerryNixon
Created July 18, 2022 23:13
Show Gist options
  • Save JerryNixon/f0b03d49dae80b4f4ec6b3445fc79cf9 to your computer and use it in GitHub Desktop.
Save JerryNixon/f0b03d49dae80b4f4ec6b3445fc79cf9 to your computer and use it in GitHub Desktop.
CIS-230-01 Week 05 Internet research
using System.Drawing;
// read file as bytes
var path = @"c:\dev\ent.png";
var bytes = File.ReadAllBytes(path);
// save as text
var base64 = Convert.ToBase64String(bytes);
var textPath = @"c:\dev\out.txt";
File.WriteAllText(textPath, base64);
// save as bytes
bytes = Convert.FromBase64String(base64);
var imgPath = @"c:\dev\out.png";
File.WriteAllBytes(imgPath, bytes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment