This documentation is archived and is not being maintained.

Encoder.Transformation Field

An Encoder object that is initialized with the globally unique identifier for the transformation parameter category.

[Visual Basic]
Public Shared ReadOnly Transformation As Encoder
public static readonly Encoder Transformation;
public: static Encoder* Transformation;
public static var Transformation : Encoder;


[C#] The following example creates a Bitmap object from a JPEG file. The code rotates the image 90 degrees and saves it in a separate JPEG file.

using System;
using System.Drawing;
using System.Drawing.Imaging;
class Example_RotateJPEG
public static void Main()
Bitmap myBitmap;
ImageCodecInfo myImageCodecInfo;
Encoder myEncoder;
EncoderParameter myEncoderParameter;
EncoderParameters myEncoderParameters;
// Create a Bitmap object based on a JPEG file.
myBitmap = new Bitmap("Shapes.jpg");
// Get an ImageCodecInfo object that represents the JPEG codec.
myImageCodecInfo = GetEncoderInfo("image/jpeg");
// Create an Encoder object based on the GUID
// for the Transformation parameter category.
myEncoder = Encoder.Transformation;
// Create an EncoderParameters object.
// An EncoderParameters object has an array of EncoderParameter
// objects. In this case, there is only one
// EncoderParameter object in the array.
myEncoderParameters = new EncoderParameters(1);
// Rotate the image 90 degrees, and save it as a separate JPEG file.
myEncoderParameter = new EncoderParameter(
myEncoderParameters.Param[0] = myEncoderParameter;
myBitmap.Save("ShapesR90.jpg", myImageCodecInfo, myEncoderParameters);
private static ImageCodecInfo GetEncoderInfo(String mimeType)
int j;
ImageCodecInfo[] encoders;
encoders = ImageCodecInfo.GetImageEncoders();
for(j = 0; j < encoders.Length; ++j)
if(encoders[j].MimeType == mimeType)
return encoders[j];
return null;

[Visual Basic, C++, JScript] No example is available for Visual Basic, C++, or JScript. To view a C# example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Encoder Class | Encoder Members | System.Drawing.Imaging Namespace