Using the library DotNetZip , I'm ziping a folder with two image files (it can be JPEG, EPS, or AI) exactly the same (for test effect), each with 7.25 MB. I get the .zip file with the size of 14.3 MB.
Apparently the compression is not being so effective, since the images are the same, the decrease should be greater, starting from the following example, is there any way to improve compression?
using (ZipFile zip = new ZipFile())
{
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression; //Adicionei isso mas não surtiu efeito.
if (Directory.Exists(Path.Combine(TempZipFiles,UniqueKey)))
{
try
{
zip.AddDirectory(Path.Combine(TempZipFiles, UniqueKey), new DirectoryInfo(UniqueKey).Name);
}
catch
{
throw;
}
}
// Salva o arquivo zip para a memória
try
{
byte[] buffer = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream())
{
zip.Save(ms);
int read;
while ((read = ms.Read(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, read);
}
return ms.ToArray();
}
}
catch
{
throw;
}
}
I do not know if it has a relationship, but I'm typing this folder:
Andtheresultofthe.zipfileisthe+filesfolderinside: