0

这个话题在 Stack Overflow 上已经被多次触及,但我的搜索仍然没有给我答案。

我正在寻找一个简单易用、非常基本的图像编辑库。我需要做的就是检查 jpeg 和 png 文件的大小并将它们旋转 90° 的倍数。

我可以在 VB.NET 或者最好是 VB5 中开发我的应用程序,并且我没有使用任何其他库。

我尝试了Advanced Image Library(基于Free Image Library),但我无法正确注册dll,我担心我在分发应用程序时也会遇到问题。

有没有更简单的?如果不是免费的也没关系,只要费用合理。

感谢您的帮助,如果答案已经在其他地方并且我看不到它,我深表歉意

4

1 回答 1

1

在 .NET 中,您可以在没有外部库的情况下进行旋转;如果您可以在 .NET 中编写代码并在此处使用 .NET Framework 原语,例如(C#):

public static Bitmap RotateImage(Image image, PointF offset, float angle)
{
 int R1, R2;
 R1 = R2 = 0;
 if (image.Width > image.Height)
        R2 = image.Width - image.Height;
 else
        R1 = image.Height-image.Width;

 if (image == null)
        throw new ArgumentNullException("image");

 //create a new empty bitmap to hold rotated image
 Bitmap rotatedBmp = new Bitmap(image.Width +R1+40, image.Height+R2+40);
 rotatedBmp.SetResolution(image.HorizontalResolution, image.VerticalResolution);

 //make a graphics object from the empty bitmap
 Graphics g = Graphics.FromImage(rotatedBmp);

 //Put the rotation point in the center of the image
 g.TranslateTransform(offset.X + R1/2+20, offset.Y + R2/2+20);

 //rotate the image
 g.RotateTransform(angle);

 //move the image back
 g.TranslateTransform(-offset.X - R1 / 2-20, -offset.Y - R2 / 2-20);

 //draw passed in image onto graphics object 
 g.DrawImage(image, new PointF(R1 / 2+20, R2 / 2+20));

 return rotatedBmp;
}
于 2011-09-03T14:30:09.720 回答