Markiert: Images


Convert Image to Byte Array (and back)

The following functions can be used to convert an image object to a byte array (and vise versa). This is often used to store images in a database or file or to use them...


Create an Icon from an Image

The following C# code changes an image object into an icon. public static Icon ConvertImageToIcon(Image img) { if (img == null) return null; Bitmap square = new Bitmap(img.Width, img.Height); // create new bitmap Graphics...


Changing size of Images

The following function changes the size of an image object and optionally changes the ratio of the image or crops the image. Perfectly for creating thumbnails. /// <summary> /// Changes the size of an image. /// </summary> /// <param name=“image“>The image.</param> /// <param name=“newWidth“>The new width of the image.</param> /// <param name=“newHeight“>The new height of the image.</param> /// <param name=“resizeOptions“>Options that define how to resize the image.</param> /// <param name=“qualityOptions“>Options that define the rendering quality.</param>...