基本与用于 VB(5 或 .NET)的简单图像处理库

发布于 2024-12-02 16:30:47 字数 312 浏览 1 评论 0原文

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

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

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

我尝试了高级图像库(基于免费图像库),但我无法正确注册dll,而且我担心在分发应用程序时也会遇到问题。

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

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

this topic has been touched multiple times on Stack Overflow, but my search still did not give me an answer.

I'm looking for a SIMPLE and easy to use, very basic, image editing library. All I need to do is check the size of jpeg and png files and rotate them by multiples of 90°.

I can develop my app in VB.NET or preferably VB5 and I'm not using any other library.

I tried the Advanced Image Library (based on Free Image Library), but I can't get the dll to correctly register and I'm afraid that I will also have problems when distributing the application.

Is there something simpler? If it's not free it's fine, as long as the cost is reasonable.

Thanks for your help and my apologies if the answer was already somewhere else and I could not see it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素罗衫 2024-12-09 16:30:47

在 .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;
}

in .NET you can do rotation without external libraries; if you can code in .NET do it and use .NET Framework primitives here for example (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;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文