Image Compression

Can any body suggest me a ready made source code for Image Compression in .net most preferably in C Sharp supporting a wide range of formats with high speed. I shall be greatful.

Thanks.
LVL 5
TheGDAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

J1H1W1Commented:
.Net supports JPEG, PNG and GIF compression.  The actual compression routines are written natively in C and ASM.  I don't think there are any compression routines written in C#.  Look at the Image.Save methods.  If they don't do what you want, could you clarify your request.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
raja_mduCommented:
.net 3.0/wpf supports jpeg compression
here is sample code

           int width = 128;
            int height = width;
            int stride = width / 8;
            byte[] pixels = new byte[height * stride];
 
            // Define the image palette
            BitmapPalette myPalette = BitmapPalettes.Halftone256;
 
            // Creates a new empty image with the pre-defined palette
            BitmapSource image = BitmapSource.Create(
                width,
                height,
                96,
                96,
                PixelFormats.Indexed1,
                myPalette,
                pixels,
                stride);
 
            FileStream stream = new FileStream("new.jpg", FileMode.Create);
            JpegBitmapEncoder encoder = new JpegBitmapEncoder();
            encoder.QualityLevel = 30;
            encoder.Frames.Add(BitmapFrame.Create(image));
            encoder.Save(stream);

Open in new window

0
TheGDAuthor Commented:
More precisely I shall require a function, that shall take image as input, but image wont be a file rather it would be in the form of array or something similer, then the function shall return the image in compressed form, this time also in the form of array or something similer.

Thanks.
0
j_s_kelleyCommented:
I have used Pegasus Imaging in the past and their tools are rock solid.  A bit pricey but if you need the flexibility and speed, they are good.

http://www.accusoft.com/
0
snoyCommented:
don't forge to add the reference to System.core in order to use System.Windows.Media.Imaging and System.IO to use the FileStream
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.