本文介绍了在Windows应用程序中保存之前如何减小图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
先生,
我在该应用程序中使用Windows应用程序,我将图片框图像保存到一个文件夹中.
它的工作正常.但我的目标是保存该图像之前,我先裁剪图像,例如高度为200,宽度为150.
和图像将保存为这些尺寸.
请给一个样品溶液先生.
谢谢
hi sir,
i am using windows application in that application i saved picturebox images into one folder.
its working fine. but my aim is before saving that image i crop the image like height is 200 and width is 150.
and images are saved to take these dimensions.
please give a sample solution sir.
Thanks
推荐答案
Dim bm_source As New Bitmap(picturebox.Image)
Dim bm_dest As New Bitmap(150, 200)
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)
gr_dest.DrawImage(bm_source, 0, 0, bm_dest.Width + 1, bm_dest.Height + 1)
picturebox.Image = bm_dest
当然,您也可以将位图立即保存到文件中,而无需将其分配回图片框.
祝你好运!
You could also save the bitmap immediately to file of course without assigning it back to the picturebox.
Good luck!
这篇关于在Windows应用程序中保存之前如何减小图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!