From the course: C# File System Tips and Tricks

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Saving images

Saving images - C# Tutorial

From the course: C# File System Tips and Tricks

Start my 1-month free trial

Saving images

- [Instructor] Now that we're able to work with text inside of a file, let's take a look at saving something a little bit more complicated like an image. In order to do this, we're going to need to import a new library. Let's go to the Solution Explorer and in the References, right-click and select Add Reference. Here, we can filter for Drawing and select System. Drawing Click the check box and hit OK. This will give us all the APIs we need in order to draw images dynamically. At the top of our class, let's go ahead and include two new namespaces. We'll type out using System.Drawing and using System.Drawing.Imaging. Then scroll down to the bottom of our class and we're going to create a new public method. It will have a return type of void and we're going to call this SaveImage. The first thing we need to do is create a path with the name of the image we want to save. We'll create a variable called imagefileName and we'll use the GetFolderByName and use the FolderName's enum…

Contents