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 7569455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:10:11+00:00 2026-05-30T15:10:11+00:00

I have a byte array that contains a jpeg image. I was just wondering

  • 0

I have a byte array that contains a jpeg image. I was just wondering if it is possible to reduce its size?

Edit: Ok. I acknowledged my mistake. Then my question is how can I reduce the quality of the image comes from a byte array.

  • 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-30T15:10:13+00:00Added an answer on May 30, 2026 at 3:10 pm

    Please understand that there is no free lunch. Decreasing the size of a JPEG image by increasing the compression will also decrease the quality of the image. However, that said, you can reduce the size of a JPEG image using the Image class. This code assumes that inputBytes contains the original image.

    var jpegQuality = 50; 
    Image image; 
    using (var inputStream = new MemoryStream(inputBytes)) {
      image = Image.FromStream(inputStream);
      var jpegEncoder = ImageCodecInfo.GetImageDecoders() 
        .First(c => c.FormatID == ImageFormat.Jpeg.Guid); 
      var encoderParameters = new EncoderParameters(1); 
      encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, jpegQuality); 
      Byte[] outputBytes; 
      using (var outputStream = new MemoryStream()) { 
        image.Save(outputStream, jpegEncoder, encoderParameters);
        outputBytes = outputStream.ToArray(); 
      } 
    }
    

    Now outputBytes contains a recompressed version of the image using a different JPEG quality.

    By decreasing the jpegQuality (should be in the range 0-100) you can increase the compression at the cost of lower image quality. See the Encoder.Quality field for more information.

    Here is an example where you can see how jpegQuality affects the image quality. It is the same photo compressed using 20, 50 and 80 as the value of jpegQuality. Sizes are 4.99, 8.28 and 12.9 KB.

    JPEG quality sample image

    Notice how the text becomes “smudged” even when the quality is high. This is why you should avoid using JPEG for images with uniformly colored areas (images/diagrams/charts created on a computer). Use PNG instead. For photos JPEG is very suitable if you do not lower the quality too much.

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

Sidebar

Related Questions

I have a an array of byte, size n, that really represents an array
I have a byte array in java. That array contains '%' symbol somewhere in
I have a byte array which contains an image fetched from the net. I
I have a byte array that contains 6 bytes last 2 represents the port
I have a SQL database that contains images stored as a byte array. I
If I have a byte array that contains UTF8 content, how would I go
I have a byte array that represents a complete TCP/IP packet. For clarification, the
I have a byte array that may or may not have null bytes at
I have byte array as input. I would like to convert that array to
I have an SHA-1 byte array that I would like to use in 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.