public Image ProcessImage(ImageFactory factory)
{
Image image = factory.Image;
try
{
float angle = this.DynamicParameter;
// Center of the image
float rotateAtX = Math.Abs(image.Width / 2);
float rotateAtY = Math.Abs(image.Height / 2);
// Create a rotated image.
image = this.RotateImage(image, rotateAtX, rotateAtY, angle);
if (factory.PreserveExifData && factory.ExifPropertyItems.Any())
{
// Set the width EXIF data.
factory.SetPropertyItem(ExifPropertyTag.ImageWidth, (ushort)image.Width);
// Set the height EXIF data.
factory.SetPropertyItem(ExifPropertyTag.ImageHeight, (ushort)image.Height);
}
return image;
}
catch (Exception ex)
{
throw new ImageProcessingException("Error processing image with " + this.GetType().Name, ex);
}
}