Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7029187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:30:20+00:00 2026-05-28T00:30:20+00:00

im using the SLsharpziplip to try to compress a byte[] before sending it on

  • 0

im using the SLsharpziplip to try to compress a byte[] before sending it on the network to a server. the byte[] contains jpeg data which is already compressed by the jpeg encoder.

you may ask , if jpeg already compress the image, why do i need to compress it more, well because i tried it and it worked.

here is what happened:

I wrote the bytes in the byte[] to a txt file , the size of the txt file is ~5k , i compressed it with winzip and the result file was ~2k , so thats about 50% reduction in the file size. however , when i try to do it with the byte[] and use the slsharziplip to compress the byte[] , the reduction in size is minimal.

here is the code i used:

 MemoryStream msCompressed = new MemoryStream();

 GZipOutputStream gzCompressed = new GZipOutputStream(msCompressed);

 gzCompressed.SetLevel(9);

  // allframes is a byte array. 

  gzCompressed.Write(allframes, 0, allframes.Length);

  gzCompressed.Finish();

  gzCompressed.IsStreamOwner = false;

  gzCompressed.Close();

  // i used byte[] compresseddata = msCompressed.ToArray() but i           thought i'll try this too.

  msCompressed.Seek(0, SeekOrigin.Begin);

  byte[] compresseddata = new byte[msCompressed.Length];

  msCompressed.Read(compresseddata, 0, compresseddata.Length);

==================================================================================

from debugging the code, i can see that the difference of size between allframes.Length and compresseddata.lenght is minimal. but if that same data is written to a text file and zipped with winzip its size is reduced by 50%.

this is how i write the same data to a txt file:

       TextWriter tw = new StreamWriter(MainPage.fs); // fs is a filestream. 

                            foreach (byte b in  allframes )

                            {

                                tw.Write(b);

                            } 

===============================================================================

am i doing something wrong?! am i misunderstanding something!!

thanks up front 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:30:20+00:00Added an answer on May 28, 2026 at 12:30 am

    Probably not, I would imagine WinZip has a superior zip algorithm to SLSharpZipLib. You can try varying the compression ratio but other than that, I would try different Silverlight compatible zip libraries.

    JPEG as you’ve correctly pointed out is already a highly compressed file type, so finding a compression algorithm that can find further redundancy is going to be difficult.

    Best regards,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using CRM 4, I have an entity form that contains a tab with an
Using SQL Server 2005 Leave Table ID StartDate EndDate 001 02/03/2010 02/03/2010 002 02/03/2010
using SQL Server 2005 standard edition with SP2 I need to design a table
Using Android TelephonyManager an application can obtain the state of data activity over the
Using MVC2 I have an AJAX form which is posting to a bound model.
Using Delphi 2010. I am looking for (possibly) a function or procedure which can
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
Using Core Data, I have a fetch request to fetch the minimum of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.