如何使用C#.net将图像分割成多个部分 [英] how to split the image into number of parts using C#.net

查看:360
本文介绍了如何使用C#.net将图像分割成多个部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将图像分割成多个部分

how to split the image into number of parts

推荐答案

您必须将每个部分创建为单独的图像。



1)加载整个图像,然后(比方说)你想要它四个相等的部分。

2)创建四个足够大的新图像来保存每个部分图像。

3)依次获取每个子图像的图形上下文(使用 Graphics.FromImage [ ^ ])并使用 Graphics.DrawImage overload [ ^ ]允许您指定目的地的位置,以及您希望绘制的原始区域。

4)你然后可以处理你的Graphics对象,并保存你的图像。
You have to create each part as a separate image.

1) Load the whole image, and (say) you want it in four equal pieces.
2) Create four new images large enough to hold each partial image.
3) Get the Graphics context for each sub image in turn (using Graphics.FromImage[^]) and use the Graphics.DrawImage overload[^] which allows you to specify the location in the destination, and the area of the original that you wish to draw.
4) You can then dispose of your Graphics objects, and save your images.


这篇关于如何使用C#.net将图像分割成多个部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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