使用 C# 更改 jpeg 图像的分辨率

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/812191/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 02:10:20  来源:igfitidea点击:

Change the resolution of a jpeg image using C#

c#jpegresolution

提问by Cristian Donoso

I need to modify the vertical and horizontal resolutions without changing the image dimensions.

我需要在不改变图像尺寸的情况下修改垂直和水平分辨率。

采纳答案by Phaedrus

Check out the Bitmap.SetResolutionMethod.

查看Bitmap.SetResolution方法。

回答by Skurmedel

If all you have is GDI, have a look at this link.

如果您只有 GDI,请查看此链接

You can save the Bitmapto a JPEG file using this snippet:

您可以使用以下代码段将位图保存到 JPEG 文件:

bmp.Save("picture.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

回答by Mark Ransom

The resolution is contained in EXIF tags within the JPEG file.

分辨率包含在 JPEG 文件的 EXIF 标签中。

Here's one article that gives source code for doing similar things in C#:

这是一篇提供在 C# 中执行类似操作的源代码的文章:

http://www.codeproject.com/KB/graphics/EXIF_tag_Editor.aspx

http://www.codeproject.com/KB/graphics/EXIF_tag_Editor.aspx