Click here to Skip to main content
15,888,016 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have an compressed image using the below code. now i dont know how to decompress it.pls help..
C#
void compress(Image img,string path){
            EncoderParameter qualityParam =
                new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 60);
            ImageCodecInfo jpegCodec = GetEncoderInfo("image/jpeg");
            EncoderParameters encoderParams = new EncoderParameters(1);
            encoderParams.Param[0] = qualityParam;
            
            img.Save("check1.jpg", jpegCodec, encoderParams);
        }
        private static ImageCodecInfo GetEncoderInfo(string mimeType)
        {
            // Get image codecs for all image formats 
            ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
 
            // Find the correct image codec 
            for (int i = 0; i < codecs.Length; i++)
                if (codecs[i].MimeType == mimeType)
                    return codecs[i];
            return null;
        }
Posted
Updated 27-Oct-12 22:00pm
v2

1 solution

you can't do that. especially with JEPGs as what they do to reduce their size is to remove as much invisible information from the image as possible, (reduce the amount of color gradients, pixels, and the like).

Think of it as allowing an ice-cube to melt to reduce it in size, for as with the image the ice-cube can't be reconstituted into as it was.

So you can re-size all you want, and add number of colors as much as you like, but you can't magically re-create the original file.

Picture compression and audio compression isn't the same as file-compression used to reduce the size temporarily of something, like one does with Zip-files.

-frank
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900