以渐进格式保存 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
这是行不通的。它不保存为渐进式。我该如何做到这一点,也许还可以指定通行证的编号。?
<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
this does not work. Its not saved as progressive. How can i do this, and maybe also specify the nr of passes.??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,它不受支持。我已尝试此处和此处 并得出此 C# 代码:
设置隔行和逐行模式,仍然保存常规基线 JPEG。我尝试过任一设置及其替代设置(非隔行扫描和非逐行扫描)的任意组合,并且在生成的图像文件中没有看到任何差异。
我还没有找到任何人的回应说他们实际上已经设法在 .NET 中保存渐进式 JPEG。
ScanMethodInterlaced
和RenderProgressive
参数值均仅描述为“在 GDI+ 版本 1.0 中未使用”。在文档。
As far as I can tell, it's not supported. I have tried code suggested here and here and arrived at this C# code:
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.
I haven't found any response from anyone saying that they have actually managed to save a progressive JPEG in .NET.
Both the
ScanMethodInterlaced
andRenderProgressive
parameter values are described only as "Not used in GDI+ version 1.0." inthe documentation.
我想使用 jpegtran 实用程序,如 图像优化,第 4 部分:渐进式 JPEG…热与否? 文章:
此外,您还可以通过以下方式优化 Haffman 表:
I suppose to use jpegtran utility as described in Image Optimization, Part 4: Progressive JPEG…Hot or Not? article:
In addition you can optimize Haffman tables by such way: