|   | ArrayToImage Class | 
 Inheritance Hierarchy
Inheritance HierarchyNamespace: Accord.Imaging.Converters
 Syntax
Syntaxpublic class ArrayToImage : IConverter<double[], Bitmap>, IConverter<double[], UnmanagedImage>, IConverter<double[][], Bitmap>, IConverter<double[][], UnmanagedImage>, IConverter<float[], Bitmap>, IConverter<float[], UnmanagedImage>, IConverter<float[][], Bitmap>, IConverter<float[][], UnmanagedImage>, IConverter<byte[], Bitmap>, IConverter<byte[], UnmanagedImage>, IConverter<byte[][], Bitmap>, IConverter<byte[][], UnmanagedImage>, IConverter<Color[], Bitmap>, IConverter<Color[], UnmanagedImage>
The ArrayToImage type exposes the following members.
 Constructors
Constructors| Name | Description | |
|---|---|---|
|  | ArrayToImage(Int32, Int32) | 
              Initializes a new instance of the ArrayToImage class.
             | 
|  | ArrayToImage(Int32, Int32, Double, Double) | 
            Initializes a new instance of the ArrayToImage class.
             | 
 Properties
Properties| Name | Description | |
|---|---|---|
|  | Height | 
              Gets or sets the height of the image
              stored in the double array.
             | 
|  | Max | 
              Gets or sets the maximum double value in the
              double array associated with the brightest color.
             | 
|  | Min | 
              Gets or sets the minimum double value in the
              double array associated with the darkest color.
             | 
|  | Width | 
              Gets or sets the width of the image
              stored in the double array.
             | 
 Methods
Methods| Name | Description | |
|---|---|---|
|  | Convert(Byte, UnmanagedImage) | 
              Converts an image from one representation to another.
              For byte transformations, the Min and Max properties
              are ignored.
             | 
|  | Convert(Byte, Bitmap) | 
              Converts an image from one representation to another.
              For byte transformations, the Min and Max properties
              are ignored.
             | 
|  | Convert(Byte, UnmanagedImage) | 
              Converts an image from one representation to another.
              For byte transformations, the Min and Max properties
              are ignored.
             | 
|  | Convert(Byte, Bitmap) | 
              Converts an image from one representation to another.
              For byte transformations, the Min and Max properties
              are ignored.
             | 
|  | Convert(Double, UnmanagedImage) | 
              Converts an image from one representation to another.
             | 
|  | Convert(Double, Bitmap) | 
              Converts an image from one representation to another.
             | 
|  | Convert(Double, UnmanagedImage) | 
              Converts an image from one representation to another.
             | 
|  | Convert(Double, Bitmap) | 
              Converts an image from one representation to another.
             | 
|  | Convert(Color, UnmanagedImage) | 
              Converts an image from one representation to another.
             | 
|  | Convert(Color, Bitmap) | 
              Converts an image from one representation to another.
              For byte transformations, the Min and Max properties are ignored. The 
              resulting image from upon calling this method will always be 32-bit ARGB.
             | 
|  | Convert(Single, UnmanagedImage) | 
              Converts an image from one representation to another.
             | 
|  | Convert(Single, Bitmap) | 
              Converts an image from one representation to another.
             | 
|  | Convert(Single, UnmanagedImage) | 
              Converts an image from one representation to another.
             | 
|  | Convert(Single, Bitmap) | 
              Converts an image from one representation to another.
             | 
|  | Equals | Determines whether the specified object is equal to the current object.(Inherited from Object.) | 
|  | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) | 
|  | GetHashCode | Serves as the default hash function. (Inherited from Object.) | 
|  | GetType | Gets the Type of the current instance.(Inherited from Object.) | 
|  | MemberwiseClone | Creates a shallow copy of the current Object.(Inherited from Object.) | 
|  | ToString | Returns a string that represents the current object.(Inherited from Object.) | 
 Extension Methods
Extension Methods| Name | Description | |
|---|---|---|
|  | HasMethod | 
              Checks whether an object implements a method with the given name.
            (Defined by ExtensionMethods.) | 
|  | IsEqual | 
                Compares two objects for equality, performing an elementwise 
                comparison if the elements are vectors or matrices.
            (Defined by Matrix.) | 
|  | To(Type) | Overloaded. 
              Converts an object into another type, irrespective of whether
              the conversion can be done at compile time or not. This can be
              used to convert generic types to numeric types during runtime.
            (Defined by ExtensionMethods.) | 
|  | ToT | Overloaded. 
              Converts an object into another type, irrespective of whether
              the conversion can be done at compile time or not. This can be
              used to convert generic types to numeric types during runtime.
            (Defined by ExtensionMethods.) | 
 Remarks
RemarksThis class can convert double and float arrays to either Grayscale or color Bitmap images. Color images should be represented as an array of pixel values for the final image. The actual dimensions of the image should be specified in the class constructor.
When this class is converting from byte or Color, the values of the Max and Min properties are ignored and no scaling operation is performed.
 Examples
ExamplesThis example converts a single array of double-precision floating- point numbers with values from 0 to 1 into a grayscale image.
// Create an array representation // of a 4x4 image with a inner 2x2 // square drawn in the middle double[] pixels = { 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, }; // Create the converter to create a Bitmap from the array ArrayToImage conv = new ArrayToImage(width: 4, height: 4); // Declare an image and store the pixels on it Bitmap image; conv.Convert(pixels, out image); // Show the image on screen image = new ResizeNearestNeighbor(320, 320).Apply(image); ImageBox.Show(image, PictureBoxSizeMode.Zoom);
The resulting image is shown below.

 See Also
See Also