Click here to Skip to main content
12,998,776 members (71,865 online)
Rate this:
Please Sign up or sign in to vote.
See more:
My program can use SetPixelColor function but after saving bitmap to jpg file my colors convert to wrong colors
Please help me for saving image to jpg file with small size and with my right colors
or help me to restore default colors
Posted 28-Sep-12 3:40am
Deepak Jena 28-Sep-12 13:43pm
You have a bitmap byte array or a bmp image ?

And mention the code, you used to convert , then only any 1 can find out what the issue is

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

 using(Image img = Image.FromFile("foo.bmp"))
        img.Save("foo.jpg", ImageFormat.Jpeg);

byte[] raw = ...todo // File.ReadAllBytes("foo.bmp");
    using(Image img = Image.FromStream(new MemoryStream(raw)))
        img.Save("foo.jpg", ImageFormat.Jpeg);

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100