This course introduces .NET developers to the System.Drawing libraries found in .NET. Developers will start with the basics, how to load and save images, and then move towards image transformation like rotation, resizing, cropping, and the powerful color matrices.
This course introduces .NET developers to the System.Drawing libraries found in .NET. It will show developers how to incorporate these libraries into any .NET application, which require the capability to manipulate images. Developers will start with the basics, like how to load and save images, and then move towards image transformations like rotation, resizing, cropping, and the powerful color matrices. Once the techniques have been mastered, we will explore how they can be used to compose stunning custom images in a multitude of .NET applications types.
Getting Started With System.Drawing Hello. My name is Joel Neubeck. Welcome to Image Composition in. NET, a course focused on how to work with images in the Microsoft. Net framework. Prior to this first version of Microsoft. NET, image processing with WIN32 in the graphical device interface or GDI was far from easy. Thankfully, the Microsoft. NET framework introduced a bunch of managed classes that exposed to. NET this GDI functionality. Introduced in Windows XP, the GDI+ subsystem was a native component that exposed low level image processing functions to. NET. In this course, we will explore how to interact with these. NET managed classes to translate, transform, compose, and manipulate images. In this first module, Getting Started With System Drawing, we're going to take a look at the basic drawing primitives. These include System. Drawing. Bitmap and System. Drawing. Graphics. Both of these classes will form the foundation of how we'll learn how to compose and manipulate images. Throughout this course, we will demonstrate image processing using various Microsoft. NET project types. All of the applications we build will be based on standard templates found in Visual Studio 2013. Some of these applications will include websites built using ASP. NET MVC, Console Applications, WebForms, WPF, as well as an ASP. NET web API project. All of the image processing techniques demonstrated can be modified to fit the type of application you find yourself building in the Microsoft. NET stack. Let's get started.
Transforming an Image Hello. My name is Joel Neubeck and this is the second module in the course, Image Composition in. NET. In this module, Transforming an Image, we look at the various ways we can use. NET to transform images. This includes techniques for cropping, resizing, and rotating an image. Let's get started with our first transformation, cropping an image. Cropping an image is the process of removing the outer, unwanted parts of that image. Sometimes the process is used to make the image smaller, while other times it may simply be used to create more focus on a specific part of the subject matter. In System. Drawing, the process used to crop an image is incredibly simple. Back in module 1 we learned about the bitmap class, and one of the public methods on bitmap is a method called Clone. Clone is used to create an exact copy of a section of an image defined by a rectangle. A rectangle is a structure that lets you define an x, a y, a width, and a height. The key to cropping lies in the rectangle and how you choose to position it. the simplest is to anchor the image in the upper left corner. When doing so, a rectangle will have the x and the y both set to 0, while the width and the height of the rectangle will represent the size of the crop. Now if you want to ensure that you take equal amounts off of each side, then you need to anchor your image by its center. You do this be simply defining your rectangle to have the appropriate x and y offset. In this case it's the width or height of the original image minus the new width or height of the desired image, and then we divide it by 2. This gives you equal amounts of offset on each side of the image.