I
info
Hi,
when i use the attached method to rotate a bitmap and save it back to
disk i always get an IO.Exception because the given file is in use by
another process. I think the Bitmap.Rotate Method in SDF fails to free
the file. Or is my code wrong?
Thank you for any hints,
Alex
public static void RotateImage( string pathImage, float Angle )
{
IImage image;
m_ImageFactory.CreateImageFromFile(pathImage, out image);
ImageInfo ii;
image.GetImageInfo(out ii);
IBitmapImage bitmapImage;
m_ImageFactory.CreateBitmapFromImage(image,
(uint)ii.Width,
(uint)ii.Height,
ii.PixelFormat,
InterpolationHint.InterpolationHintDefault,
out bitmapImage );
Bitmap b = ImageUtils.IBitmapImageToBitmap(bitmapImage);
Bitmap b2 = ImageUtils.Rotate(b, Angle);
b2.Save( pathImage, System.Drawing.Imaging.ImageFormat.Bmp);
}
when i use the attached method to rotate a bitmap and save it back to
disk i always get an IO.Exception because the given file is in use by
another process. I think the Bitmap.Rotate Method in SDF fails to free
the file. Or is my code wrong?
Thank you for any hints,
Alex
public static void RotateImage( string pathImage, float Angle )
{
IImage image;
m_ImageFactory.CreateImageFromFile(pathImage, out image);
ImageInfo ii;
image.GetImageInfo(out ii);
IBitmapImage bitmapImage;
m_ImageFactory.CreateBitmapFromImage(image,
(uint)ii.Width,
(uint)ii.Height,
ii.PixelFormat,
InterpolationHint.InterpolationHintDefault,
out bitmapImage );
Bitmap b = ImageUtils.IBitmapImageToBitmap(bitmapImage);
Bitmap b2 = ImageUtils.Rotate(b, Angle);
b2.Save( pathImage, System.Drawing.Imaging.ImageFormat.Bmp);
}