This page is the starting point for all code samples. As I discover something new/interesting I’ll be creating code samples explaining a specific topic. These samples are not intended to be full on applications, but rather components that can be used in applications. If you would like me to create a code sample on a specific topic please drop me a comment here, or reach me via twitter @DefaultSoftware All code is released under the Ms-PL license.
Navigate to an article by clicking the relevant thumbnail image.
Article and sample code illustrating how to create Windows Forms applications with customized borders implemented using GDI.
This article provides a discussion on how to determine whether a file is read only or not, provides three different methods of setting a file to read only and provides three different methods of negating a file’s read only status. Full code sample and source code download included.
The purpose of this article is to illustrate Deserializing Xml data to object data that resides in application memory. Additionally this article details implementing generics, resulting in a single method being able to deserialize multiple object types. This article relates to the article: C# How to: Implementing Xml Serialization through a generic extension method
This article will illustrate how to create deep copies of an object by making use of binary serialization implemented in the form of an extension method with generic type support. A short discussion is included on the differences between shallow copy and deep copy.
Web Service Definition Language (WSDL) is an Xml based schema that exactly details the custom data types and web service methods exposed by a web service. Developers usually generate web service client proxy code in order to call into web services. Since WSDL is an exact description of a web service it is also possible to generate code that represents the service in the form of web method stubs. This article illustrates how to generate a web service from WSDL.
This article illustrates a basic introductory level explanation of the steps required to interface with the Microsoft Kinect for Windows sensor using the Kinect for Windows Sdk implemented in a Windows Forms application.
This article details how to decode or convert Base64 encoded strings back into Bitmap images by means of extending the string class. Note: This article is an update that builds upon the article: C# How to: Encoding Bitmaps to Base64 strings
In this article we discover creating basic image filters implemented by directly manipulating the ARGB colour values associated with an image’s pixels. The different types of filters discussed are: Grayscale, Transparency, Image Negative and Sepia tone. All filters are implemented as extension methods targeting the Image class, as well as the Bitmap class as the result of inheritance and upcasting.
This article is based around creating basic Image filters. The different types of filters discussed are: Grayscale, Transparency, Image Negative and Sepia tone. All filters are implemented as extension methods targeting the Image class, as well as the Bitmap class as the result of inheritance and upcasting.
Note: This article is a follow up to C# How to: Image filtering by directly manipulating Pixel ARGB values. The previously published related article implements image filtering by performing calculations and updating image pixel colour component values namely Alpha, Red, Green and Blue. This article achieves the same image filtering through implementing various ColorMatrix transformations, in essence providing an alternative solution. For the sake of convenience I have included the pixel manipulation extension methods in addition to the ColorMatrix extension methods detailed by this article.
In this article we explore how to combine or blend two Bitmap images by implementing various colour filters affecting how an Image appear as part of the resulting blended image. The concepts detailed in this article are reinforced and easily reproduced by making use of the sample source code that accompanies this article.
This article is aimed at detailing how to implement the process of substituting the colour values that form part of a Bitmap image. Colour substitution is implemented by means of a threshold value. By implementing a threshold a range of similar colours can be substituted.
This article illustrates the process of generating icon files (*.ico) from user specified input images. The accompanying sample source code implements a Windows Forms application, allowing for easily testing the icon generation process.
The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application.
In this follow up article we further explore manipulating a Bitmap image’s underlying pixel data. This article is part 2 of the Linq to Bitmaps series, we’ll be focussing on partial colour inversion using Linq queries. This article was published as a follow up to: C# How to: Bitmap Pixel manipulation using LINQ Queries.
This article explores the concept of manipulating the Colour Balance of a Bitmap image. Colour Balance values are updated by directly manipulating a Bitmap’s underlying pixel data, no GDI drawing code required.
The purpose of this article is to explore and illustrate the concept of creating bi-tonal bitmap images. Colour images are manipulated in such a fashion to only express two colours. The colours expressed are configurable. A threshold value determines which of the two configured colours will be applied to a pixel.
The purpose of this article is to illustrate the tasks required when implementing a colour tint on a Bitmap image. The various Bitmap manipulation operations detailed in this article are all exclusively implemented by processing raw pixel data. No traditional GDI+ drawing operations are required in achieving the objective of this article
The objective of this article is focussed on exploring the concept of applying Colour Shading to Bitmap images. The various Bitmap manipulation operations detailed in this article are all exclusively implemented by processing raw pixel data. No traditional GDI+ drawing operations are required in implementing Bitmap Colour Shading.
The focus of this article is set on exploring the concept of Image Solarisation. In this article the tasks required to perform Image Solarisation are entirely implemented on pixel data level. Image manipulation is only implemented in the form of updating the individual Alpha, Red, Green and Blue colour components expressed by Image pixels.
In this article you’ll find a discussion on the topic of blending Bitmap images into a single Image. Various possible methods can be employed in blending images. In this scenario image blending is achieved through means of bitwise operations, implemented on individual colour components Red, Green and Blue.
The objective of this article is to illustrate Image Arithmetic being implemented when blending/combining two separate images into a single result image. The types of Image Arithmetic discussed are: Average, Add, SubtractLeft, SubtractRight, Difference, Multiply, Min, Max and Amplitude.
This article is intended to serve as an introduction to the concepts related to creating and processing convolution filters being applied on images. The Convolution filters discussed are: Blur, Gaussian Blur, Soften, Motion Blur, High Pass, Edge Detect, Sharpen and Emboss.
The objective of this article is to explore various edge detection algorithms. The types of edge detection discussed are: Laplacian, Laplacian of Gaussian, Sobel, Prewitt and Kirsch. All instances are implemented by means of Image Convolution.
In this article we explore the concept of Difference of Gaussians edge detection. This article implements image convolution as a means of achieving Gaussian blurring. All of the concepts explored are implemented by accessing and manipulating the raw pixel data exposed by an image, no GDI+ or conventional drawing code is required.
The objective of this article is focussed on providing a discussion on implementing a Median Filter on an image. This article illustrates varying levels of filter intensity: 3×3, 5×5, 7×7, 9×9, 11×11 and 13×13.
The purpose of this article is to explore and illustrate the concept of Image Unsharp Masking. This article implements image convolution in the form of a 3×3 Gaussian Blur, 5×5 Gaussian Blur, 3×3 Mean filter and a 5×5 Mean filter.
The purpose of this article is aimed at exploring the concepts of Image Erosion, Image Dilation, Open Morphology and Closed Morphology. In addition this article extends conventional Image Erosion and Dilation implementations through partial colour variations of Image Erosion and Dilation.
The objective of this article is to explore Image Edge Detection implemented by means of Image Dilation and Image Erosion morphological filters. In addition we explore the concept of Image Sharpening implementing morphological edge detection.
The purpose of this article is to detail Boolean Function Based Edge Detection. The Image filtering implemented in this article occurs on a per pixel basis. The implementation relies on linear algebra. No GDI+ or traditional drawing methods are required.
This article provides a technical discussion exploring the topic of Gradient Based Edge Detection and related aspects. Several filtering options are illustrated and explained ranging from pure black and white edge detection to image sharpening.
In this article we explore the tasks related to creating a Cartoon Effect from images which reflect real world non-animated scenarios. When applying a Cartoon Effect it becomes possible with relative ease to create images appearing to have originated from a drawing/animation.
It is the objective of this article to explore and provide a discussion based in the concept of Edge Detection through means of Image Sharpening. Illustrated are various methods of image sharpening and in addition a Median filter implemented in image noise reduction.
This article’s purpose is to explain and illustrate in detail the requirements involved in calculating Gaussian Kernels intended for use in image convolution when implementing Gaussian Blur filters. This article’s discussion spans from exploring concepts in theory and continues on to implement concepts through C# sample source code.
This article serves to provides an introduction and discussion relating to Image Blurring methods and techniques. The Image Blur methods covered in this article include: Box Blur, Gaussian Blur, Mean Filter, Median Filter and Motion Blur.
This article provides a discussion exploring the concept of image rotation as a geometric transformation. In addition to conventional image rotation this article illustrates the concept of individual colour channel rotation.
This article is focussed on illustrating the steps required in performing an image Shear Transformation. All of the concepts explored have been implemented by means of raw pixel data processing, no conventional drawing methods, such as GDI, are required.
This article illustrates and provides a discussion and implementation of Image Oil Painting Filters and related Image Cartoon Filters.
This article serves to provides a detailed discussion and implementation of a Stained Glass Image Filter. Primary topics explored include: Creating Voronoi Diagrams, Pixel Coordinate distance calculations implementing Euclidean, Manhattan and Chebyshev methods. In addition, this article explores Gradient Based Edge Detection implementing thresholds.
This article explores the concept of rendering ASCII Art from source images. Beyond exploring concepts this article also provides a practical implementation of all the steps required in creating an Image ASCII Filter.
It is the purpose of this article to illustrate the concept of Difference of Gaussians Edge Detection. This article extends the conventional implementation of Difference of Gaussian algorithms through the application of equally sized matrix kernels only differing by a weight factor.
This article explores various image processing concepts, which feature in combination when implementing Image Boundary Extraction. Concepts covered within this article include: Morphological Image Erosion and Image Dilation, Image Addition and Subtraction, Boundary Sharpening, Boundary Tracing and Boundary Extraction.
This article explores Abstract Colour Image filters as a process of Non-photo Realistic Image Rendering. The output images produced reflects a variety of artistic effects.