.NET 中图像的自动缩放

发布于 2024-07-27 16:15:46 字数 423 浏览 0 评论 0原文

我正在考虑一个个人学习项目。 使用.NET(最好是VB)我想构建一个简单的桌面应用程序,其唯一功能是显示漫画,如CDisplay,但具有更高级的导航。 我希望能够通过单击图像的某些区域(例如单个面板)来放大,并让缩放区域自动捕捉到面板并将其放大。 这些图像通常采用标准格式,如 .jpeg、.png 等。

我想要的是这样的: http://iphonecomicbookreader.com/

我什至不知道这叫什么? 图像映射? 也许是色调映射? 是否可以在 .NET 中执行此操作,或者是否需要某种外部库? 代码示例会很好,但显然这是一个相当模糊的请求。 只要指出正确的方向就会非常有帮助。

谢谢

I'm considering a personal learning project. Using .NET(preferably VB) I want to build a simple desktop app that's only function is to display comics, like CDisplay, but with more advanced navigation. I want to be able zoom in by clicking on certain areas of an image, individual panels for instance, and have the zoom area automatically snap to the panel and blow it up. The images are usually in a standard format like .jpeg, .png, etc..

Something like this is what I'm going for: http://iphonecomicbookreader.com/

I'm not even sure what this is called? Image mapping? Tone mapping maybe? Is it possible to do this within .NET or would it require some kind of outside library? Code samples would be nice, but obviously this is pretty vague request. Just being pointed in the right direction would be really helpful.

Thanks

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

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

发布评论

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

评论(1

五里雾 2024-08-03 16:15:46

您完全可以在 .Net 中完成此操作。 以下是对该主题的精彩概述:

http://www.codeproject.com/KB /books/1861004990.aspx

是C#的,不过把这个东西翻译成VB确实不难。 在这两种语言中,只需创建对象和设置属性等即可。

本质上,您将原始图像加载到 Bitmap 对象中(使用内置方法)。 当您想要放大某些内容时,您可以定义一个 Rectangle 对象来描述您想要缩放到的区域,然后使用 Graphics 对象的 DrawImage 方法将该区域复制并调整大小到一个新的 Bitmap 中,然后您可以按照您的意愿显示该区域。喜欢。 该代码示例展示了如何使用所有这些方法。

其中唯一相对困难的部分是自动确定每个面板的边界。 如果某些面板的形状不规则(例如《家庭马戏团》,就好像有人读过一样),或者如果漫画的扫描没有完美对齐,这可能会特别困难。 最好在您的应用程序中包含漫画,其中包含原始图像以及您预先定义的描述面板边界的区域。

如果您在使用示例时遇到任何问题,请在此处发布另一个问题,我(以及其他数千人)将很乐意提供帮助。

更新:这是我编写的示例应用程序,它基本上显示了如何使用.Net 做到这一点。 运行程序,然后单击卡通中的每个面板,下面将显示每个面板的放大图像。 我将在一秒钟内发布它的代码。

更新2:这是源代码

更新 3:这是原始漫画的上下文。 这是我对杰夫·阿特伍德的敬意。 :)

You can do this entirely in .Net. Here is an excellent overview of the subject:

http://www.codeproject.com/KB/books/1861004990.aspx

It's C#, but it's really not hard to translate this stuff into VB. In both languages, it's just a matter of creating objects and setting properties and so on.

Essentially you load the original image into a Bitmap object (using built-in methods). When you want to zoom in on something, you define a Rectangle object that describes the region you want to zoom to, then use the DrawImage method of your Graphics object to copy and resize that region into a new Bitmap, which you then display however you like. The code example shows how to use all of these methods.

The only relatively difficult part of this would be to automatically determine the boundaries of each panel. This could be especially difficult if some of the panels are irregularly shaped (like Family Circus, as if anybody reads that), or if the scan of the comic is not perfectly aligned. It might be better to include comics with your application that contain the original image along with Regions that you've pre-defined that describe the boundaries of the panels.

If you run into any problems using the samples, post another question here and I (and 1000s of others) will be happy to help.

Update: here's a sample app I wrote that shows basically how to do this with .Net. Run the program, then click on each of the panels in the cartoon, and a zoomed-in image of each panel will be displayed below. I'll post the code for it in a second.

Update 2: here's the source code.

Update 3: and here's the original comic in context. Consider this my homage to Jeff Atwood. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文