如何以位图格式保存图像以及在该图像上绘制的矩形 [英] How to save an image in bitmap format along with rectangle which is drawn on that image

查看:256
本文介绍了如何以位图格式保存图像以及在该图像上绘制的矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Silverlight 5的新手。我正在开发一个Silverlight应用程序,通过网络摄像头捕获图像并将该图像分配给图像控件。

I am new to Silverlight 5. I am developing a Silverlight application to capture an image through a webcam and assign that image to an image control.

现在,在将图像分配给图像控件后,它允许用户绘制形状,例如矩形。

Now after assigning the image to the image control it allows the user to draw a shape, for example a rectangle.

现在的问题是,当我尝试保存该图像以及矩形时,不保存矩形(仅保存图像)。

Now the problem is that when I am trying to save that image, along with rectangle, the rectangle is not saved (only image is saved).

请让我知道这个问题的解决方案。

Please let me know the solution for this problem.

推荐答案

要编辑图像,它最简单的方法是使用 WriteableBitmap 类。您可以从任何 BitmapSource 创建 WriteableBitmap 实例。

To edit images, it is probably easiest to use the WriteableBitmap class. You can create a WriteableBitmap instance from any BitmapSource.

要编辑图像,您可以使用 WriteableBitmap Extensions 库,其中包含便于绘图的方法图像中的矩形。

To then edit the image, you can use the WriteableBitmap Extensions library, which among other things contain convenience methods for drawing rectangles in the image.

最后,如果您需要有关如何保存图像的说明,请查看示例这里

Finally, if you need instructions on how to save the image, take a look for example here.

这篇关于如何以位图格式保存图像以及在该图像上绘制的矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆