以逐行格式保存JPG [英] Save JPG in progressive format

查看:309
本文介绍了以逐行格式保存JPG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<Extension()> _
Public Sub Save(ByVal b As Bitmap, ByVal FileName As String, ByVal Compression As Long, ByVal MimeType As String)
    Dim Params As EncoderParameters = New EncoderParameters(2)
    Dim CodecInfo As ImageCodecInfo = GetEncoderInfo(MimeType)

    Params.Param(0) = New EncoderParameter(Encoder.RenderMethod, EncoderValue.RenderProgressive)
    Params.Param(1) = New EncoderParameter(Encoder.Quality, Compression)

    b.Save(FileName, CodecInfo, Params)
End Sub

这不工作。它不保存为进步。我可以这样做,也可以指定通行证的nr。

this does not work. Its not saved as progressive. How can i do this, and maybe also specify the nr of passes.??

推荐答案

据我所知,不支持。我已尝试过此处这里,并到达这里C#code:

As far as I can tell, it's not supported. I have tried code suggested here and here and arrived at this C# code:

using (Image source = Image.FromFile(@"D:\temp\test2.jpg")) {

  ImageCodecInfo codec = ImageCodecInfo.GetImageEncoders().First(c => c.MimeType == "image/jpeg");

  EncoderParameters parameters = new EncoderParameters(3);
  parameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
  parameters.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.ScanMethod, (int)EncoderValue.ScanMethodInterlaced);
  parameters.Param[2] = new EncoderParameter(System.Drawing.Imaging.Encoder.RenderMethod, (int)EncoderValue.RenderProgressive);

  source.Save(@"D:\temp\saved.jpg", codec, parameters);
}

设置隔行扫描和逐行扫描模式,我尝试了任何设置和他们的替代设置(非隔行和非渐进)的任何组合,并没有看到任何差异在所有的结果图像文件。

Setting both interlaced and progressive mode, it still saves a regular baseline JPEG. I have tried any combination of either setting and their alternative settings (non-interlaced and non-progressive), and haven't seen any difference at all in the resulting image file.

我没有找到任何人的回应,说他们实际上设法在.NET中保存渐进式JPEG。

I haven't found any response from anyone saying that they have actually managed to save a progressive JPEG in .NET.

ScanMethodInterlaced RenderProgressive 参数值仅描述为GDI +版本1.0中未使用。在
文档
中。

Both the ScanMethodInterlaced and RenderProgressive parameter values are described only as "Not used in GDI+ version 1.0." in the documentation.

这篇关于以逐行格式保存JPG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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