当前位置: 代码迷 >> ASP.NET >> JPEG无损压缩,该怎么处理
  详细解决方案

JPEG无损压缩,该怎么处理

热度:1481   发布时间:2013-02-25 00:00:00.0
JPEG无损压缩
各位大大们、

有谁有 jpeg huffman 压缩的类不。。给我个。。

不好找啊。。



------解决方案--------------------------------------------------------
感觉没必要压缩

换成byte[]
MemeryStream ms = new MemeryStream(); 
PicruteBox.Image.Save(ms,Imaging.ImageFormat.Jpeg); 
byte[] bytes=ms.ToArray();

源码
------解决方案--------------------------------------------------------
JPEG天生就不是无损的,失真算法怎么可能无损压缩?
------解决方案--------------------------------------------------------


http://archive.cnblogs.com/a/2007463/

------解决方案--------------------------------------------------------
嗯,我理解你的意思了...你所谓的“无损”其实是人眼难以察觉的失真,每张图片差异很大,每个人眼也有差异,想要找要一个刚好人眼难以察觉的失真“度”...很明确地告诉你,计算机不可能做到...

想要找到一个对所有图片都统一压缩率的人眼难以察觉的失真“度”更是不可能的...
------解决方案--------------------------------------------------------
探讨
不是。。比如我有1张60K的JPEG图片。。然后我压缩之后。比如剩下……

------解决方案--------------------------------------------------------
jpeg还能无损?用png吧。
------解决方案--------------------------------------------------------
可以去看看
一个.net 压缩位图至JPEG的代码
asp.net JPEG无损压缩
asp.net JPEG无损压缩
------解决方案--------------------------------------------------------
C# code
using System;using System.Text;using System.Runtime.Serialization;using System.Runtime.Serialization.Formatters.Binary;using System.Collections;using System.IO;using Microsoft.Win32;using System.Diagnostics;/// <summary>/// Compress 的摘要说明/// </summary>public class CompressFiles{   /// <summary>   /// 压缩文件   /// </summary>   /// <param name="DFilePath">需要压缩的文件夹或者单个文件</param>   /// <param name="DRARName">生成压缩文件的文件名</param>   /// <param name="DRARPath">生成压缩文件保存路径</param>   /// <returns></returns>   public static bool CompressRAR(string DFilePath, string DRARName, string DRARPath)   {   String the_rar;   RegistryKey the_Reg;   Object the_Obj;   String the_Info;   ProcessStartInfo the_StartInfo;   Process the_Process;   try   {   the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command");   the_Obj = the_Reg.GetValue("");   the_rar = the_Obj.ToString();   the_Reg.Close();   the_rar = the_rar.Substring(1, the_rar.Length - 7);   the_Info = " a " + " " + DRARName + " " + DFilePath + " -ep1"; //命令 + 压缩后文件名 + 被压缩的文件或者路径   the_StartInfo = new ProcessStartInfo();   the_StartInfo.FileName = the_rar;   the_StartInfo.Arguments = the_Info;   the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;   the_StartInfo.WorkingDirectory = DRARPath; //RaR文件的存放目录。   the_Process = new Process();   the_Process.StartInfo = the_StartInfo;   the_Process.Start();   the_Process.WaitForExit();   the_Process.Close();   return true;   }   catch (Exception ex)   {   return false;   }   }   /// <summary>   /// 解压缩到指定文件夹   /// </summary>   /// <param name="RARFilePath">压缩文件存在的目录 </param>   /// <param name="RARFileName">压缩文件名称 </param>   /// <param name="UnRARFilePath">解压到文件夹</param>   /// <param name="isCovering">是否覆盖原来文件</param>   /// <returns></returns>   public static bool DecompressionRAR(string RARFilePath, string RARFileName, string UnRARFilePath, bool isCovering)   {   //解压缩   String the_rar;   RegistryKey the_Reg;   Object the_Obj;   String the_Info;   ProcessStartInfo the_StartInfo;   Process the_Process;   try   {   the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");   the_Obj = the_Reg.GetValue("");   the_rar = the_Obj.ToString();   the_Reg.Close();   the_rar = the_rar.Substring(1, the_rar.Length - 7);   if (isCovering)   {   the_Info = @"x -o+" + " " + RARFilePath + RARFileName + " " + UnRARFilePath;   }   else {   the_Info = @"x -o-" + " " + RARFilePath + RARFileName + " " + UnRARFilePath;   }   the_StartInfo = new ProcessStartInfo();   the_StartInfo.FileName = the_rar;   the_StartInfo.Arguments = the_Info;   the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;   the_Process = new Process();   the_Process.StartInfo = the_StartInfo;   the_Process.Start();   return true;   }   catch (Exception ex)   {   return false;   }   }}
  相关解决方案