如何调整图像宽度和高度,而不增加图像的物理尺寸 [英] How resize image width and hegiht WITHOUT increase image physical size

查看:108
本文介绍了如何调整图像宽度和高度,而不增加图像的物理尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我需要减少图像宽度和高度(有时甚至只需10px),但是当我这样做时,物理尺寸会增加2甚至3倍!

我尝试2方法

Hi every one.
I need to reduce image width and height (sometimes just 10px even), but when i do it, the physical size increase 2 or even 3 times!
I try 2 method

var newImage = new Bitmap(newWidth, newHeight);
Graphics.FromImage(newImage).DrawImage(image, 0, 0, newWidth, newHeight);









And

var newImage = image.GetThumbnailImage(newWidth, newHeight, null, IntPtr.Zero);





它们都会增加物理图像。因为有时我会减小宽度10px,因为我需要500px宽度的所有照片,人们上传图像,例如510px宽度。

在这种情况下增加物理尺寸更多。



有什么建议吗?

提前致谢。



Both of them increase physical image. coz sometimes i reduce width 10px, coz i need all photos in 500px width, and people upload images for example in 510px width.
in this situation increasing physical size is more.

Any suggestion please?
Thanks in advance.

推荐答案

检查你要保存的图像格式类型as - 例如BMP的占地面积比jpg大。同时检查您要保存的分辨率。这两个因素都会影响物理文件大小。



点击这里:



http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.save。 aspx [ ^ ]



和这里





[ ^ ]
Check what image format type you are saving as - BMP for example has a bigger footprint than jpg. Also check the resolution you are saving at. Both of these factors affect physical file size.

Look here:

http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.save.aspx[^]

and here


[^]


这篇关于如何调整图像宽度和高度,而不增加图像的物理尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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