Click or drag to resize

AtalaImageGetChangedPixelFormat Method

Examples
GetChangedPixelFormat Example (C#)
// Load an image.
AtalaImage image = new AtalaImage(@"D:\Test Images\1.jpg");
AtalaImage converted = null;

// Convert the image to 8-bit Grayscale.
// Be sure the image is a different PixelFormat or an exception is thrown.
if (image.PixelFormat != PixelFormat.Pixel8bppGrayscale)
{
    converted = image.GetChangedPixelFormat(PixelFormat.Pixel8bppGrayscale);
    image.Dispose();
}
else
    converted = image;
GetChangedPixelFormat Example (Visual Basic)
' Load an image.
Dim image As AtalaImage = New AtalaImage("D:\Test Images\1.jpg") 
Dim converted As AtalaImage = Nothing 

' Convert the image to 8-bit Grayscale.
' Be sure the image is a different PixelFormat or an exception is thrown.
If image.PixelFormat <> PixelFormat.Pixel8bppGrayscale Then
    converted = image.GetChangedPixelFormat(PixelFormat.Pixel8bppGrayscale)
    image.Dispose()
Else 
    converted = image
End If
This function converts an AtalaImage from one PixelFormat to another.
Overload List
  NameDescription
Public methodGetChangedPixelFormat(PixelFormat)
Returns a new AtalaImage object with a different PixelFormat from this AtalaImage.
Public methodCode exampleGetChangedPixelFormat(PixelFormat, ColorProfile)
Returns a new AtalaImage object with a different PixelFormat from this AtalaImage.
Public methodGetChangedPixelFormat(PixelFormat, ColorProfile, Boolean)
Returns a new AtalaImage object with a different PixelFormat from this AtalaImage specifying a ColorProfile and if the ChangedPixelFormat event should fire.
Top
Examples
GetChangedPixelFormat Example (C#)
// Load an image.
AtalaImage image = new AtalaImage(@"D:\Test Images\1.jpg");
AtalaImage converted = null;

// Convert the image to 8-bit Grayscale.
// Be sure the image is a different PixelFormat or an exception is thrown.
if (image.PixelFormat != PixelFormat.Pixel8bppGrayscale)
{
    converted = image.GetChangedPixelFormat(PixelFormat.Pixel8bppGrayscale);
    image.Dispose();
}
else
    converted = image;
GetChangedPixelFormat Example (Visual Basic)
' Load an image.
Dim image As AtalaImage = New AtalaImage("D:\Test Images\1.jpg") 
Dim converted As AtalaImage = Nothing 

' Convert the image to 8-bit Grayscale.
' Be sure the image is a different PixelFormat or an exception is thrown.
If image.PixelFormat <> PixelFormat.Pixel8bppGrayscale Then
    converted = image.GetChangedPixelFormat(PixelFormat.Pixel8bppGrayscale)
    image.Dispose()
Else 
    converted = image
End If
See Also